
#ifndef SOM_Stack_xih
#define SOM_Stack_xih


#if (defined(Stack_Class_Source) || defined(SOM_Module_stack_Source))
#ifndef SOM_DLL_stack
#define SOM_DLL_stack
#endif
#endif

#if defined(__IBMC__) && (__IBMC__ >= 300)
  #pragma info(none)
#else
  #if defined(__IBMC__)
     #pragma checkout(suspend)
  #endif
#endif


/*
 * Set the scope of method functions
 */
#ifndef SOM_Scope
#define SOM_Scope static 
#endif

#ifndef SOM_Stack_xh
#include "stack.xh"
#endif
#include <somcsr.h>

/*
 * -- Instance Data
 */
typedef struct {
	long stackTop;
	long stackValues[10];
} __somC_Stack_ProtectedPrivateData;
typedef __somC_Stack_ProtectedPrivateData StackData, *StackDataPtr;

/*
 * -- GetData Macro
 */
typedef StackDataPtr SOMLINK somTP_Stack_DataThunk(void*);
typedef somTP_Stack_DataThunk *somTD_Stack_DataThunk;

#define StackGetData(somSelf) \
   (((somTD_Stack_DataThunk)(StackCClassData.instanceDataToken))(somSelf))
#ifdef VARIABLE_MACROS
#define _stackTop somThis->stackTop
#define _stackValues somThis->stackValues
#endif


/*
 * -- Method Macros for use in Method Procedures
 */
#ifdef METHOD_MACROS
  #define _somDefaultInit somSelf->somDefaultInit
  #define _somDestruct somSelf->somDestruct
  #define _somDefaultCopyInit somSelf->somDefaultCopyInit
  #define _somDefaultAssign somSelf->somDefaultAssign
  #define _somDefaultConstCopyInit somSelf->somDefaultConstCopyInit
  #define _somDefaultVCopyInit somSelf->somDefaultVCopyInit
  #define _somDefaultConstVCopyInit somSelf->somDefaultConstVCopyInit
  #define _somDefaultConstAssign somSelf->somDefaultConstAssign
  #define _somDefaultVAssign somSelf->somDefaultVAssign
  #define _somDefaultConstVAssign somSelf->somDefaultConstVAssign
  #define _somInit somSelf->somInit
  #define _somUninit somSelf->somUninit
  #define _somFree somSelf->somFree
  #define _somGetClass somSelf->somGetClass
  #define _somGetClassName somSelf->somGetClassName
  #define _somGetSize somSelf->somGetSize
  #define _somIsA somSelf->somIsA
  #define _somIsInstanceOf somSelf->somIsInstanceOf
  #define _somRespondsTo somSelf->somRespondsTo
  #define _somDispatch somSelf->somDispatch
  #define _somClassDispatch somSelf->somClassDispatch
  #define _somCastObj somSelf->somCastObj
  #define _somResetObj somSelf->somResetObj
  #define _somPrintSelf somSelf->somPrintSelf
  #define _somDumpSelf somSelf->somDumpSelf
  #define _somDumpSelfInt somSelf->somDumpSelfInt
  #define _full somSelf->full
  #define _empty somSelf->empty
  #define _top somSelf->top
  #define _pop somSelf->pop
  #define _push somSelf->push
  #define _somDefaultInit somSelf->somDefaultInit
#endif /* METHOD_MACROS */


/*
 * -- Primary Implementation File Support
 */
#if (defined(Stack_Class_Source) || defined(SOM_Module_stack_Source))

#ifndef StackMethodDebug
   #define StackMethodDebug(c,m) SOMMethodDebug(c,m)
#endif  /* StackMethodDebug */

static void SOMLINK __somC_Stack_classInit(SOMClass *cls);


/*
 * Init ClassData Structures
 */
struct StackClassDataStructure SOM_IMPORTEXPORT_stack_stack SOMDLINK StackClassData = {0};
struct StackCClassDataStructure SOM_IMPORTEXPORT_stack_stack SOMDLINK StackCClassData = {0};


/*
 * Identifiers
 */
static char __somC_Strings_Stack0[] = {"Stack"}; /* class name */
static char __somC_Strings_Stack1[] = {"full"}; /* method name */
static char __somC_Strings_Stack2[] = {"empty"}; /* method name */
static char __somC_Strings_Stack3[] = {"top"}; /* method name */
static char __somC_Strings_Stack4[] = {"pop"}; /* method name */
static char __somC_Strings_Stack5[] = {"push"}; /* method name */
static char __somC_Strings_Stack6[] = {"SOMObject"}; /* parent name */
static char __somC_Strings_Stack7[] = {"somDefaultInit"}; /* overridden method name */
static char * __somC_Stack_regIdsArray[] = {
	__somC_Strings_Stack0,
#ifndef __somC_Stack_regIds_full
#define __somC_Stack_regIds_full 1
#endif
	__somC_Strings_Stack1,
#ifndef __somC_Stack_regIds_empty
#define __somC_Stack_regIds_empty 2
#endif
	__somC_Strings_Stack2,
#ifndef __somC_Stack_regIds_top
#define __somC_Stack_regIds_top 3
#endif
	__somC_Strings_Stack3,
#ifndef __somC_Stack_regIds_pop
#define __somC_Stack_regIds_pop 4
#endif
	__somC_Strings_Stack4,
#ifndef __somC_Stack_regIds_push
#define __somC_Stack_regIds_push 5
#endif
	__somC_Strings_Stack5,
	__somC_Strings_Stack6,
#ifndef __somC_Stack_regIds_somDefaultInit
#define __somC_Stack_regIds_somDefaultInit 7
#endif
	__somC_Strings_Stack7
};


/*
 * Overridden method: somDefaultInit
 */
SOM_Scope void  SOMLINK somDefaultInit(Stack *somSelf,
		som3InitCtrl* ctrl);

/*
 * New Method: full
 */
SOM_Scope boolean  SOMLINK full(Stack *somSelf, Environment *ev);
#ifndef somId_full
#define somId_full ((somId)&(__somC_Stack_regIdsArray[__somC_Stack_regIds_full]))
#endif
#define SOM_MPR_MINFO_full {10, 8, 0}
static somMpRowMethodInfo Stack_full_mp_minfoRow = {{0, SOM_MP_ROWTYPE_METHODINFO}, SOM_MPR_MINFO_full};
#ifndef DEFINEDStack_full_mp
#define DEFINEDStack_full_mp
/*[ ::Stack::full Stack_full_mp ]*/
/* Contract specification:
[CALLTYPE_IDL (2)][RESULT][VERSION 0]
RESULT[out]: Boolean
*/
static struct { void * rows; unsigned char csr[4]; } Stack_full_mp={&Stack_full_mp_minfoRow, {
0x86, 0x01, 0x88},
};
#endif
#define full_somMethodInfoValue 0
#define full_somApplyStubValue &Stack_full_mp.csr
#define full_somHasMPlan 8

/*
 * New Method: empty
 */
SOM_Scope boolean  SOMLINK empty(Stack *somSelf, Environment *ev);
#ifndef somId_empty
#define somId_empty ((somId)&(__somC_Stack_regIdsArray[__somC_Stack_regIds_empty]))
#endif
#define SOM_MPR_MINFO_empty {10, 8, 0}
static somMpRowMethodInfo Stack_empty_mp_minfoRow = {{0, SOM_MP_ROWTYPE_METHODINFO}, SOM_MPR_MINFO_empty};
#ifndef DEFINEDStack_empty_mp
#define DEFINEDStack_empty_mp
/*[ ::Stack::empty Stack_empty_mp ]*/
/* Contract specification:
[CALLTYPE_IDL (2)][RESULT][VERSION 0]
RESULT[out]: Boolean
*/
static struct { void * rows; unsigned char csr[4]; } Stack_empty_mp={&Stack_empty_mp_minfoRow, {
0x86, 0x01, 0x88},
};
#endif
#define empty_somMethodInfoValue 0
#define empty_somApplyStubValue &Stack_empty_mp.csr
#define empty_somHasMPlan 8

/*
 * New Method: top
 */
SOM_Scope long  SOMLINK top(Stack *somSelf, Environment *ev);
#ifndef somId_top
#define somId_top ((somId)&(__somC_Stack_regIdsArray[__somC_Stack_regIds_top]))
#endif
#define SOM_MPR_MINFO_top {0, 8, 0}
static somMpRowMethodInfo Stack_top_mp_minfoRow = {{0, SOM_MP_ROWTYPE_METHODINFO}, SOM_MPR_MINFO_top};
#ifndef DEFINEDStack_top_mp
#define DEFINEDStack_top_mp
/*[ ::Stack::top Stack_top_mp ]*/
/* Contract specification:
[CALLTYPE_IDL (2)][RESULT][EXT_HEADER][VERSION 0][HASATTR][USEREXCEPT]
RESULT[out]: Long
RAISES: [::Stack::STACK_UNDERFLOW <noparams>]
*/
static struct somcsr_exception_entry Stack_top_mp_exn0061a2a0[1] = {
	{"::Stack::STACK_UNDERFLOW",{0,NULL}}};
static struct somcsr_Exception_Attributes Stack_top_mp_attr0061a2a0 = {1, Stack_top_mp_exn0061a2a0};
static struct { void * rows; unsigned char csr[4]; void * attrlist[1];} Stack_top_mp={&Stack_top_mp_minfoRow, {
0x96, 0x05, 0x01, 0x83},
{	 (void *)&Stack_top_mp_attr0061a2a0}
};
#endif
#define top_somMethodInfoValue 0
#define top_somApplyStubValue &Stack_top_mp.csr
#define top_somHasMPlan 8

/*
 * New Method: pop
 */
SOM_Scope long  SOMLINK pop(Stack *somSelf, Environment *ev);
#ifndef somId_pop
#define somId_pop ((somId)&(__somC_Stack_regIdsArray[__somC_Stack_regIds_pop]))
#endif
#define SOM_MPR_MINFO_pop {0, 8, 0}
static somMpRowMethodInfo Stack_pop_mp_minfoRow = {{0, SOM_MP_ROWTYPE_METHODINFO}, SOM_MPR_MINFO_pop};
#ifndef DEFINEDStack_pop_mp
#define DEFINEDStack_pop_mp
/*[ ::Stack::pop Stack_pop_mp ]*/
/* Contract specification:
[CALLTYPE_IDL (2)][RESULT][EXT_HEADER][VERSION 0][HASATTR][USEREXCEPT]
RESULT[out]: Long
RAISES: [::Stack::STACK_UNDERFLOW <noparams>]
*/
static struct somcsr_exception_entry Stack_pop_mp_exn0061a2a0[1] = {
	{"::Stack::STACK_UNDERFLOW",{0,NULL}}};
static struct somcsr_Exception_Attributes Stack_pop_mp_attr0061a2a0 = {1, Stack_pop_mp_exn0061a2a0};
static struct { void * rows; unsigned char csr[4]; void * attrlist[1];} Stack_pop_mp={&Stack_pop_mp_minfoRow, {
0x96, 0x05, 0x01, 0x83},
{	 (void *)&Stack_pop_mp_attr0061a2a0}
};
#endif
#define pop_somMethodInfoValue 0
#define pop_somApplyStubValue &Stack_pop_mp.csr
#define pop_somHasMPlan 8

/*
 * New Method: push
 */
SOM_Scope void  SOMLINK push(Stack *somSelf, Environment *ev,
		long el);
#ifndef somId_push
#define somId_push ((somId)&(__somC_Stack_regIdsArray[__somC_Stack_regIds_push]))
#endif
#define SOM_MPR_MINFO_push {0, 12, 0}
static somMpRowMethodInfo Stack_push_mp_minfoRow = {{0, SOM_MP_ROWTYPE_METHODINFO}, SOM_MPR_MINFO_push};
#ifndef DEFINEDStack_push_mp
#define DEFINEDStack_push_mp
/*[ ::Stack::push Stack_push_mp ]*/
/* Contract specification:
[CALLTYPE_IDL (2)][EXT_HEADER][VERSION 0][HASATTR][USEREXCEPT]
ARG 0[in]: Long
RAISES: [::Stack::STACK_OVERFLOW <noparams>]
*/
static struct somcsr_exception_entry Stack_push_mp_exn0061a490[1] = {
	{"::Stack::STACK_OVERFLOW",{0,NULL}}};
static struct somcsr_Exception_Attributes Stack_push_mp_attr0061a490 = {1, Stack_push_mp_exn0061a490};
static struct { void * rows; unsigned char csr[4]; void * attrlist[1];} Stack_push_mp={&Stack_push_mp_minfoRow, {
0x92, 0x05, 0x01, 0x43},
{	 (void *)&Stack_push_mp_attr0061a490}
};
#endif
#define push_somMethodInfoValue 0
#define push_somApplyStubValue &Stack_push_mp.csr
#define push_somHasMPlan 8

/*
 * Functions for attributes.
 */

/*
 * Special Method Support
 */
#define Stack_BeginInitializer_somDefaultInit \
   if (!ctrl) { \
      ctrl = &globalCtrl; \
      memcpy(ctrl,&((StackCClassData.parentMtab)->initCtrl),sizeof(somInitCtrl)); \
   } \
   myMask = ctrl->mask; \
   somThis = (StackDataPtr)((char*)somSelf + ctrl->info->dataOffset);\
   ctrl->info = (somInitInfo*)(ctrl->infoSize + (char*)(ctrl->info)); \
   ctrl->mask += 1;

/*
 * Ancestor_Init Macros
 */
#define Stack_Init_SOMObject_somDefaultInit(somSelf, ctrl) \
    if (myMask[0]&1) \
       ((somTD_SOMObject_somDefaultInit) \
           ctrl->info->defaultInit) \
               ((SOMObject *)((void *) somSelf), ctrl)

/*
 * -- Routines and Structures to create the class object
 */
static SOMClass ** __somC_Stack_parentArray[] = {
	NULL,
};

void * __somC_Stack_parentMtabs[1];

somMethodDefn __somC_Stack_newNDMethodsArray[] = {
	{  (0 | full_somHasMPlan), 0, (somMToken)0, (somMethodPtr)full, 
	   0, (somMethodPtr)full_somApplyStubValue, 
	   (somMethodInfo *) full_somMethodInfoValue, &StackClassData.full, 0, 1 },
	{  (0 | empty_somHasMPlan), 0, (somMToken)0, (somMethodPtr)empty, 
	   0, (somMethodPtr)empty_somApplyStubValue, 
	   (somMethodInfo *) empty_somMethodInfoValue, &StackClassData.empty, 0, 1 },
	{  (0 | top_somHasMPlan), 0, (somMToken)0, (somMethodPtr)top, 
	   0, (somMethodPtr)top_somApplyStubValue, 
	   (somMethodInfo *) top_somMethodInfoValue, &StackClassData.top, 0, 1 },
	{  (0 | pop_somHasMPlan), 0, (somMToken)0, (somMethodPtr)pop, 
	   0, (somMethodPtr)pop_somApplyStubValue, 
	   (somMethodInfo *) pop_somMethodInfoValue, &StackClassData.pop, 0, 1 },
	{  (0 | push_somHasMPlan), 0, (somMToken)0, (somMethodPtr)push, 
	   0, (somMethodPtr)push_somApplyStubValue, 
	   (somMethodInfo *) push_somMethodInfoValue, &StackClassData.push, 0, 1 }
};

static somSpecialOverrides __somC_Stack_specialOverridesArray[] = {
  {0, 0, (somMethodPtr)somDefaultInit },
};

static somClassVars1 __somC_Stack_classVars1 = {
	1,		/* layoutVersion */
	(void *)NULL,	/* extension */
	sizeof(StackData),	/* dataSize */
	4,		/* type code dataAlignment */
	(somMethodPtr)0,	/* classAllocate */
	(somMethodPtr)0	/* classDeallocate */
};

static struct StackClassDataStructure __somC_Stack_resolvedMTokens;
static void * __somC_Stack_unsharedClassVariablesPtr = 0;
extern som3ClassInfoStruct __somC_Stack_ClassInfo; /* C++ forward reference */

static SOM_CIB Stack_ClassInitBlock = {
	1,	/* layoutVersion */
	&__somC_Stack_classVars1,
	&__somC_Stack_unsharedClassVariablesPtr,	/* unsharedVars */
	Stack_MajorVersion,
	Stack_MinorVersion,
	0x60014,	/* constFlags */
	0xFFFFFFFF,	/* inheritVars */
	(SOMClass**)0,	/* classMeta */
	(somMethodPtr) __somC_Stack_classInit,	/* classInit */
	(somMethodPtr) 0,	/* classUninit */
	(somMethodPtr) 0,	/* legacyInit */
	(somMethodPtr) 0,	/* legacyUninit */
	(somMethodPtr) 0,	/* udaAssign */
	(somMethodPtr) 0,	/* udaConstAssign */
	0,	/* protectedDataOffset */
	0,	/* numEmbeddedObjs */
	0,	/* embeddedObjs */
	8,	/* numRegIds */
	__somC_Stack_regIdsArray,	/* regIds */
	((sizeof(struct StackClassDataStructure) - sizeof(SOMClass *))/sizeof(somMToken)),	/* numClassDataEntries */
	(somClassDataStructurePtr)&StackClassData,
	(somCClassDataStructurePtr)&StackCClassData,
	&__somC_Stack_ClassInfo,
	1,	/* numParents */
	(SOMClass***)__somC_Stack_parentArray,	/* parents */
	1,	/* numDirectInitClasses */
	(SOMClass***)__somC_Stack_parentArray,	/* directInitClasses */
	0,	/* numNewInitializers */
	0,	/* newInitializerSymbols */
	0,	/* numOvInitializers */
	0,	/* ovInitializerSymbols */
	__somC_Stack_specialOverridesArray,	/* special overrides */
	5,	/* maxNDMethods */
	__somC_Stack_newNDMethodsArray,	/* newNDMethods */
	0,	/* numOverrides */
	0,	/* overrides */
	0,	/* numInheritedSelections */
	0,	/* inheritedSelections */
	0,	/* numMigratedMethods */
	0 	/* migratedMethods */
};	/* CIB */
static som3ClassDetails __somC_Stack_ClassDetails = {
	(somMethodTabPtr)NULL,	/* mtab */
	(somMethodTabPtr *)__somC_Stack_parentMtabs,	/* parentMtabs */
	&Stack_ClassInitBlock,	/* ClassInitBlock address */
	(somTD_somRenewNoInitNoZeroThunk)0,	/* somRenewNoInitNoZeroThunk */
	(long)0,	/* instanceSize */
	(somMethodProc**)NULL,	/* resolvedInits */
	(somClassDataStructure *)&__somC_Stack_resolvedMTokens,	/* resolvedMTokens */
	{0,0,0,0},	/* initCtrl */
	{0,0,0,0},	/* destructCtrl */
	{0,0,0,0},	/* assignCtrl */
	(long)1,	/* layoutVersion */
	(void*)NULL,	/* extension */
	(somDToken)NULL,	/* publicDataToken */
	(somDToken)NULL,	/* protectedDataToken */
};
som3ClassInfoStruct __somC_Stack_ClassInfo = {
	0,	/* classObject */
	&__somC_Stack_ClassDetails	/* class details */
};


/*
 * Class Creation and Initialization
 */

#if defined(__IBMC__) && (defined(__OS2__) || defined(_WIN32)) && !defined(SOM_PREWARP)
#pragma alloc_text (SEG0002, __somC_Stack_classInit)
#pragma alloc_text (SEG0002, StackNewClass)
#endif

/* classinit function */
SOM_Scope void SOMLINK __somC_Stack_classInit(SOMClass *somSelf)
{
   SOM_IgnoreWarning(somSelf);
}

/* NewClass Function */
SOMEXTERN SOM_IMPORTEXPORT_stack_stack SOMClass * SOMLINK  StackNewClass (long reqMajorVersion, long reqMinorVersion)
{
    if (_SOMCLASS_Stack && _SOMCLASS_Stack->somCheckVersion(reqMajorVersion, reqMinorVersion))
          return ((SOMClass*)((void*)_SOMCLASS_Stack));
__somC_Stack_parentArray[0] = (SOMClass **)&_SOMCLASS_SOMObject;
   /* require parents */
   if (!_SOMCLASS_SOMObject) SOMObjectNewClass(SOMObject_MajorVersion,SOMObject_MinorVersion);
   /* return new class */
   return ((SOMClass*)(void*)somBuildClass2(&Stack_ClassInitBlock, reqMajorVersion, reqMinorVersion));
}

#if defined(__IBMC__) && (__IBMC__ >= 300)
  #pragma info(restore)
#else
  #if defined(__IBMC__)
    #pragma checkout(resume)
  #endif
#endif



#endif /* Primary Implementation Support */

#endif       /* SOM_Stack_xih */
