Resolve/C++ Catalog
CT/XYZ/Kernel_C.h
Copyright © 2010, Reusable Software Research Group, The Ohio State University

//  /*-------------------------------------------------------------------*\
//  |   Concrete Template : XYZ_Kernel_C
//  \*-------------------------------------------------------------------*/

#ifndef CT_XYZ_KERNEL_C
#define CT_XYZ_KERNEL_C 1

///---------------------------------------------------------------------
/// Global Context -----------------------------------------------------
///---------------------------------------------------------------------

/*!
    #include "AT/XYZ/Kernel.h"
!*/

///---------------------------------------------------------------------
/// Interface ----------------------------------------------------------
///---------------------------------------------------------------------

// This component has all the template parameters of the abstract
// template whose instances it can check (in this case, XYZ_Kernel),
// plus one additional parameter which is the particular instance of
// XYZ_Kernel that is to be checked.

concrete_template <
	concrete_instance class Item,
	concrete_instance class XYZ_Base
	/*!
	    implements
		abstract_instance XYZ_Kernel <Item>
	!*/
    >
class XYZ_Kernel_C :
    checks
	concrete_instance XYZ_Base
{
public:

    // Suppose OpA is the only one of the XYZ_Kernel operations that
    // has a requires clause.  If other operations had non-trivial
    // preconditions, then they would be here, too, with entirely
    // parallel code bodies.
    
    procedure_body OpA (
	    preserves Integer i,
	    consumes Text& t,
	    produces Item& x
	)
    {
	assert (
		// The two arguments to "assert" are: a Boolean-valued
		// expression that SHOULD be true (i.e., the
		// precondition as evaluated here); and a Text-valued
		// expression that is literally the precondition
		// violated (i.e., the precondition to be reported in
		// a "violated assertion" message if the first
		// argument is false).
	    );
	self.XYZ_Base::OpA (i, t, x);
    }  

};

#endif // CT_XYZ_KERNEL_C

Last modified: Thu Jan 11 17:05:57 EST 2007