// @(#)root/gl:$Id: TGLPShapeRef.cxx 20882 2007-11-19 11:31:26Z rdm $
// Author:  Matevz Tadel, Feb 2007

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TGLPShapeRef.h"
#include "TGLPhysicalShape.h"

//______________________________________________________________________
// TGLPShapeRef
//
// Base class for references to TGLPysicalShape that need to be notified
// when the shape is destroyed.
// Could also deliver 'change' notifications.

ClassImp(TGLPShapeRef)

//______________________________________________________________________
TGLPShapeRef::TGLPShapeRef() :
   fNextPSRef (0),
   fPShape    (0)
{
   // Default contructor.
}

//______________________________________________________________________
TGLPShapeRef::TGLPShapeRef(TGLPhysicalShape * shape) :
   fNextPSRef (0),
   fPShape    (0)
{
   // Constructor with known shape - reference it.

   SetPShape(shape);
}
//______________________________________________________________________
TGLPShapeRef::~TGLPShapeRef()
{
   // Destructor - unreference the shape if set.

   SetPShape(0);
}

//______________________________________________________________________
void TGLPShapeRef::SetPShape(TGLPhysicalShape * shape)
{
   // Set the shape. Unreference the old and reference the new.
   // This is virtual so that sub-classes can perform other tasks
   // on change. This function should be called first from there.
   //
   // This is also called from destructor of the refereced physical
   // shape with 0 argument.

   if (fPShape)
      fPShape->RemoveReference(this);
   fPShape = shape;
   if (fPShape)
      fPShape->AddReference(this);
}

//______________________________________________________________________
void TGLPShapeRef::PShapeModified()
{
   // This is called from physical shape when it is modified.
   // Sub-classes can override and take appropriate action.
}

Last update: Thu Jan 17 08:52:06 2008

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.