/*
 *    @(#)37 1.1 9/28/93 11:46:35 [10/14/94] (c)IBM Corp. 1992
 */

// This file was generated by the SOM Compiler.
// FileName: ll.id2.
// Generated using:
//     SOM Precompiler spc: 6.9
//     SOM Emitter emitidl.dll: 6.8

//  This class is adapted from the book
//    Class Construction in C and C++, Object Oriented Fundamentals
//    by Roger Sessions, Copyright (c) 1992 Prentice Hall.
//  Reprinted with permission.

#ifndef ll_idl
#define ll_idl

#include "bt.idl"

interface link;

interface linkedList : baseType
{
  baseType llHead();
  
  // Make the head of the list the current link, and
  // return its contents.

  baseType llTail();
  
  // Make the tail of the list the current link, and
  // returns its contents.

  long llLength();
  
  // Return the number of links is the list.

  void llSetMax(in long newMax);
  
  // Set the maximum number of links the list can contain.

  long llLeft();
  
  // Return the number of links that can still be added to the
  // list.

  baseType llNext();
  
  // Make the link after current the new current link, and
  // return its contents.

  baseType llPrevious();
  
  // Make the link before current the new current link, and
  // return its contents.

  baseType llRetrieve();
  
  // Return the contents of the current link.

  baseType llReplace(in baseType newElement);
  
  // Replace the contents of the current list but this new
  // element, and return a pointer to the new contents.

  baseType llPromoteTail();
  
  // Move the tail link to the head of the list, and return
  // its contents.

  baseType llAddHead(in baseType newElement);
  
  // Add a link containing this new Element to the head of the
  // list, and return a pointer to the new Element.

  baseType llAddTail(in baseType newElement);
  
  // Add a link containing this new Element to the tail of the
  // list, and return a pointer to the new Element.

  baseType llRemoveHead();
  
  // Delete the link at the head of the list.

  long llIsTail();
  
  // Returns TRUE if the current link is the head of the list,
  // FALSE otherwise.

  void llFreeContents();
  
  // Frees the entire list, including the contents of each link.

  void llTrace(inout FILE output);
  
  // Trace the linkedList, useful for debugging.



#ifdef __SOMIDL__
  implementation {

    releaseorder: llHead,llTail,llLength,llSetMax,llLeft,llNext,llPrevious, 
                  llRetrieve,llReplace,llPromoteTail,llAddHead,llAddTail, 
                  llRemoveHead,llIsTail,llFreeContents,llTrace;

    //# Class Modifiers
    callstyle = oidl;
    local; 
    filestem = ll;

    passthru C_h =      "#include \"bt.h\""
"#include <stdio.h>";


    //# Internal Instance Variables
    long max;                      
    long nlinks;                   
    link currentLink;             
    link headLink;                
    link tailLink;                

    //# Method Modifiers
    print: override;
    somInit: override;
    somUninit: override;
    somDumpSelfInt: override;

    //# Data Modifiers
    max: ;
    nlinks: ;
    currentLink: ;
    headLink: ;
    tailLink: ;

  };
#endif /* __SOMIDL__ */
};

#endif  /* ll_idl */
