// $Source: /usr/local/SimSoft/SoftShop/Basics/Structur/DLNode.h,v $
// $Revision: 1.20 $
// $Author: baum $
// $Date: 2001/11/29 15:52:23 $
//
// Login name of the user who locked the revision
// $Locker:  $
// Tag name used to checkout the file
// $Name: Release-20 $
// State assigned to revision
// $State: Exp $
//
//
// $Log: DLNode.h,v $
// Revision 1.20  2001/11/29 15:52:23  baum
// -In Kalender.cpp und Kalender.h Handsteuerung eingebaut
//

#ifndef _DLNODE_H
#define _DLNODE_H

#include <stddef.h>
#include "SLNode.h"

#if defined __GNUG__ || defined __hpux
#  pragma interface
#endif

//==================================================================
//		Klassen-Header
//		fuer class DLNode<T>
//==================================================================

//##ModelId=3FBCBCC70177
template <class T>
class DLNode
  {
  public:
    // constructors
	//##ModelId=3FBCBCC70179
    DLNode ();
	//##ModelId=3FBCBCC70186
    DLNode (const DLNode<T>&);
	//##ModelId=3FBCBCC70188
    DLNode (T*);

    // destructor
	//##ModelId=3FBCBCC7018A
    ~DLNode () {};

    // assignment operators
	//##ModelId=3FBCBCC7018B
    const DLNode<T>& operator = (const DLNode<T>&);
	//##ModelId=3FBCBCC70197
    const DLNode<T>& operator = (const T&);
	//##ModelId=3FBCBCC70199
    const DLNode<T>& operator = (T*&);

    // handle DLNodes
	//##ModelId=3FBCBCC701A5
    DLNode<T>* prelink (DLNode<T>* before);
	//##ModelId=3FBCBCC701A7
    DLNode<T>* postlink (DLNode<T>* after);
	//##ModelId=3FBCBCC701A9
    DLNode<T>* unlink ();

    // data members
	//##ModelId=3FBCBCC701B6
    DLNode<T>* Prev;
	//##ModelId=3FBCBCC701C6
    DLNode<T>* Next;
	//##ModelId=3FBCBCC701CA
    T* Object;

};	// class DLNode

//==================================================================
//		Inline-Quellcode
//		fuer class DLNode<T>
//==================================================================

//##ModelId=3FBCBCC70179
template <class T>
inline DLNode<T>::DLNode () : Prev (NULL), Next (NULL), Object (NULL) { }

//##ModelId=3FBCBCC70186
template <class T>
inline DLNode<T>::DLNode (const DLNode<T>& d)
: Prev (NULL), Next (NULL), Object (d.Object) { }

//##ModelId=3FBCBCC70188
template <class T>
inline DLNode<T>::DLNode (T* t)
: Prev (NULL), Next (NULL), Object (t) { }

//##ModelId=3FBCBCC7018B
template <class T>
inline const DLNode<T>& DLNode<T>::operator = (const DLNode<T>& d) {
  Object = d.Object;
  return *this;
}

//##ModelId=3FBCBCC70197
template <class T>
inline const DLNode<T>& DLNode<T>::operator = (const T& t) {
  Object = (T*) &t;
  return *this;
}

//##ModelId=3FBCBCC70199
template <class T>
inline const DLNode<T>& DLNode<T>::operator = (T*& t) {
  Object = t;
  return *this;
}

//##ModelId=3FBCBCC701A5
template <class T>
inline DLNode<T>* DLNode<T>::prelink (DLNode<T>* before) {
  if ((Prev = before->Prev) != NULL)  Prev->Next = this;
  Next = before;
  return before->Prev = this;
}

//##ModelId=3FBCBCC701A7
template <class T>
inline DLNode<T>* DLNode<T>::postlink (DLNode<T>* after) {
  if ((Next = after->Next) != NULL)  Next->Prev = this;
  Prev = after;
  return after->Next = this;
}

//##ModelId=3FBCBCC701A9
template <class T>
inline DLNode<T>* DLNode<T>::unlink () {
  if (Prev) Prev->Next = Next;
  if (Next) Next->Prev = Prev;
  Prev = Next = NULL;
  return this;
}

#endif	// !defined _DLNODE_H

