// /*-------------------------------------------------------------------*\
// | Concrete Template : Stack_Kernel_2
// \*-------------------------------------------------------------------*/
#ifndef CT_STACK_KERNEL_2
#define CT_STACK_KERNEL_2 1
///---------------------------------------------------------------------
/// Global Context -----------------------------------------------------
///---------------------------------------------------------------------
#include "AT/Stack/Kernel.h"
#include "CT/List/Kernel_1a.h"
///---------------------------------------------------------------------
/// Interface ----------------------------------------------------------
///---------------------------------------------------------------------
concrete_template <
concrete_instance class Item,
concrete_instance class List_Of_Item =
List_Kernel_1a <Item>,
concrete_instance class Rep =
Representation <List_Of_Item>
>
class Stack_Kernel_2 :
implements
abstract_instance Stack_Kernel <Item>,
encapsulates
concrete_instance Rep
{
private:
rep_field_name (Rep, 0, List_Of_Item, items);
/*!
convention
self[items].left = empty_string
correspondence
self = self[items].right
!*/
public:
standard_concrete_operations (Stack_Kernel_2);
procedure_body Push (
consumes Item& x
)
{
self[items].Add_Right (x);
}
procedure_body Pop (
produces Item& x
)
{
self[items].Remove_Right (x);
}
function_body Item& operator [] (
preserves Accessor_Position& current
)
{
return self[items][current];
}
function_body Integer Length ()
{
return self[items].Right_Length ();
}
};
#endif // CT_STACK_KERNEL_2
Last modified: Thu Jan 11 17:05:57 EST 2007