#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Core/Container/Branch/BLink.hh" // This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVL_BLINK_HEADER #define RAVL_BLINK_HEADER 1 /////////////////////////////////////////////////////////////////////////// //! rcsid="$Id: BLink.hh,v 1.1 2002/04/05 12:59:07 craftit Exp $" //! lib=RavlCore //! author="Charles Galambos" //! docentry="Ravl.Core.Branch" //! author="Charles Galambos" //! file="Ravl/Core/Container/Branch/BLink.hh" #include "Ravl/Types.hh" #include "Ravl/RefCounter.hh" #include "Ravl/SmartPtr.hh" namespace RavlN { //! userlevel=Develop //: Link and data. template class BLinkBodyC : public RCBodyC { public: BLinkBodyC() {} //: Default constructor. BLinkBodyC(const DataT &dat) : data(dat) {} //: Constructor. BLinkBodyC(const DataT &dat,const SmartPtrC > &nnext) : data(dat), next(nnext) {} //: Constructor. DataT &Data() { return data; } //: Access data. const DataT &Data() const { return data; } //: Access data. SmartPtrC > &Next() { return next; } //: Access to next element in list. const SmartPtrC > &Next() const { return next; } //: Access to next element in list. protected: DataT data; SmartPtrC > next; }; //! userlevel=Advanced //: Link in list. template class BLinkC : public SmartPtrC > { public: BLinkC() {} //: Default constructor. BLinkC(const DataT &dat) : SmartPtrC >(*new BLinkBodyC(dat)) {} //: Construct from data. BLinkC(const DataT &dat,const SmartPtrC > &nnext) : SmartPtrC >(*new BLinkBodyC(dat,nnext)) {} //: Construct from data, and next in list BLinkC(RCHandleC > &handle) : SmartPtrC >(handle) {} //: Construct from a base handle. protected: BLinkC(BLinkBodyC &body) : SmartPtrC >(body) {} //: Body constructor. BLinkBodyC &Body() { return RCHandleC >::Body(); } //: Access body. const BLinkBodyC &Body() const { return RCHandleC >::Body(); } //: Access body. public: DataT &Data() { return Body().Data(); } //: Access data. const DataT &Data() const { return Body().Data(); } //: Access data. SmartPtrC > &Next() { return Body().Next(); } //: Access next in list. const SmartPtrC > &Next() const { return Body().Next(); } //: Access next in list. }; } #endif