/*
   b_short_int_common.cpp   Generated by the Ballista(tm) Project data object compiler
   Copyright (C) 1998-2001  Carnegie Mellon University

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

   File generated Tuesday, May 22 at 04:52 PM EDT

TITLE
   b_short_int_common.cpp
*/

//--------------------------------------------------------------------

#include <errno.h>
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <stream.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#include "b_short_int_common.h"

//--------------------------------------------------------------------


 //--------------------------------------------------------------------

CLASSNAME::CLASSNAME()
{
  //DIAL DECLARATIONS HERE

  //generated

   strcpy(_b_short_int_commonTYPENAME,CLASS_STRING);
strcpy(_b_short_int_commonZERO,"b_short_int_common_ZERO");
strcpy(_b_short_int_commonONE,"b_short_int_common_ONE");
strcpy(_b_short_int_commonTWO,"b_short_int_common_TWO");
strcpy(_b_short_int_commonFIFTEEN,"b_short_int_common_FIFTEEN");
strcpy(_b_short_int_commonSIXTEEN,"b_short_int_common_SIXTEEN");
strcpy(_b_short_int_commonSEVENTEEN,"b_short_int_common_SEVENTEEN");
strcpy(_b_short_int_commonSC_PAGE,"b_short_int_common_SC_PAGE");
strcpy(_b_short_int_commonSIXTYFOUR,"b_short_int_common_SIXTYFOUR");
strcpy(_b_short_int_commonSIXTYFIVE,"b_short_int_common_SIXTYFIVE");
strcpy(_b_short_int_commonONE27,"b_short_int_common_ONE27");
strcpy(_b_short_int_commonONE29,"b_short_int_common_ONE29");
strcpy(_b_short_int_commonTWO55,"b_short_int_common_TWO55");
strcpy(_b_short_int_commonTWO56,"b_short_int_common_TWO56");
strcpy(_b_short_int_commonTWO57,"b_short_int_common_TWO57");
strcpy(_b_short_int_commonI4K,"b_short_int_common_I4K");
strcpy(_b_short_int_commonI8K,"b_short_int_common_I8K");
strcpy(_b_short_int_commonI8193,"b_short_int_common_I8193");
strcpy(_b_short_int_commonI16383,"b_short_int_common_I16383");
strcpy(_b_short_int_commonMAXSHORT,"b_short_int_common_MAXSHORT");
}

//--------------------------------------------------------------------
b_param *b_short_int_common::b_short_int_commonZERO()
{
   return &_b_short_int_commonZERO;
}

b_param *b_short_int_common::b_short_int_commonONE()
{
   return &_b_short_int_commonONE;
}

b_param *b_short_int_common::b_short_int_commonTWO()
{
   return &_b_short_int_commonTWO;
}

b_param *b_short_int_common::b_short_int_commonFIFTEEN()
{
   return &_b_short_int_commonFIFTEEN;
}

b_param *b_short_int_common::b_short_int_commonSIXTEEN()
{
   return &_b_short_int_commonSIXTEEN;
}

b_param *b_short_int_common::b_short_int_commonSEVENTEEN()
{
   return &_b_short_int_commonSEVENTEEN;
}

b_param *b_short_int_common::b_short_int_commonSC_PAGE()
{
   return &_b_short_int_commonSC_PAGE;
}

b_param *b_short_int_common::b_short_int_commonSIXTYFOUR()
{
   return &_b_short_int_commonSIXTYFOUR;
}

b_param *b_short_int_common::b_short_int_commonSIXTYFIVE()
{
   return &_b_short_int_commonSIXTYFIVE;
}

b_param *b_short_int_common::b_short_int_commonONE27()
{
   return &_b_short_int_commonONE27;
}

b_param *b_short_int_common::b_short_int_commonONE29()
{
   return &_b_short_int_commonONE29;
}

b_param *b_short_int_common::b_short_int_commonTWO55()
{
   return &_b_short_int_commonTWO55;
}

b_param *b_short_int_common::b_short_int_commonTWO56()
{
   return &_b_short_int_commonTWO56;
}

b_param *b_short_int_common::b_short_int_commonTWO57()
{
   return &_b_short_int_commonTWO57;
}

b_param *b_short_int_common::b_short_int_commonI4K()
{
   return &_b_short_int_commonI4K;
}

b_param *b_short_int_common::b_short_int_commonI8K()
{
   return &_b_short_int_commonI8K;
}

b_param *b_short_int_common::b_short_int_commonI8193()
{
   return &_b_short_int_commonI8193;
}

b_param *b_short_int_common::b_short_int_commonI16383()
{
   return &_b_short_int_commonI16383;
}

b_param *b_short_int_common::b_short_int_commonMAXSHORT()
{
   return &_b_short_int_commonMAXSHORT;
}

//--------------------------------------------------------------------
//---------------------------------------------------------------------------
//type name return method

b_param *CLASSNAME::typeName()
{
  return &_b_short_int_commonTYPENAME;
}

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
int CLASSNAME::distanceFromBase()
{
  return CLASSPARENT::distanceFromBase() +1;
}


//---------------------------------------------------------------------------
void CLASSNAME::typeList(b_param list[], int num)
{
  strcpy(list[num],(char *) typeName());
  CLASSPARENT::typeList(list,num+1);
}
//--------------------------------------------------------------------
  void *CLASSNAME::access(b_param data[])
{
  if (strcmp(data[0],(char *)typeName())!=0)
    return CLASSPARENT::access(data);

  //ACCESS CODE
b_short_int_common_zero = 0;
b_short_int_common_one = 0;
b_short_int_common_two = 0;
b_short_int_common_fifteen = 0;
b_short_int_common_sixteen = 0;
b_short_int_common_seventeen = 0;
b_short_int_common_sc_page = 0;
b_short_int_common_sixtyfour = 0;
b_short_int_common_sixtyfive = 0;
b_short_int_common_one27 = 0;
b_short_int_common_one29 = 0;
b_short_int_common_two55 = 0;
b_short_int_common_two56 = 0;
b_short_int_common_two57 = 0;
b_short_int_common_i4k = 0;
b_short_int_common_i8k = 0;
b_short_int_common_i8193 = 0;
b_short_int_common_i16383 = 0;
b_short_int_common_maxshort = 0;
   int dataPTR =0;


   dataPTR++;
if (strcmp(data[dataPTR],_b_short_int_commonZERO)==0)
      b_short_int_common_zero = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonONE)==0)
      b_short_int_common_one = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonTWO)==0)
      b_short_int_common_two = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonFIFTEEN)==0)
      b_short_int_common_fifteen = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonSIXTEEN)==0)
      b_short_int_common_sixteen = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonSEVENTEEN)==0)
      b_short_int_common_seventeen = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonSC_PAGE)==0)
      b_short_int_common_sc_page = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonSIXTYFOUR)==0)
      b_short_int_common_sixtyfour = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonSIXTYFIVE)==0)
      b_short_int_common_sixtyfive = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonONE27)==0)
      b_short_int_common_one27 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonONE29)==0)
      b_short_int_common_one29 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonTWO55)==0)
      b_short_int_common_two55 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonTWO56)==0)
      b_short_int_common_two56 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonTWO57)==0)
      b_short_int_common_two57 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonI4K)==0)
      b_short_int_common_i4k = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonI8K)==0)
      b_short_int_common_i8k = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonI8193)==0)
      b_short_int_common_i8193 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonI16383)==0)
      b_short_int_common_i16383 = 1;
   else if (strcmp(data[dataPTR],_b_short_int_commonMAXSHORT)==0)
      b_short_int_common_maxshort = 1;
  else
    {
      cerr<<"Error: Unknown setting for the "
          <<"VALUE"
          <<" dial of the data object "
          <<CLASS_STRING
          <<". "<<endl
          <<"The offending string is : "
          <<data[dataPTR]
          <<endl;
      exit(1);
    }

if (b_short_int_common_zero==1)
{

 _theVariable=0;
 
}

if (b_short_int_common_one==1)
{

 _theVariable=1;
 
}

if (b_short_int_common_two==1)
{

 _theVariable=2;
 
}

if (b_short_int_common_fifteen==1)
{

 _theVariable=15;
 
}

if (b_short_int_common_sixteen==1)
{

 _theVariable=16;
 
}

if (b_short_int_common_seventeen==1)
{

 _theVariable=17;
 
}

if (b_short_int_common_sc_page==1)
{

 _theVariable=_SC_PAGESIZE;
 
}

if (b_short_int_common_sixtyfour==1)
{

 _theVariable=64;
 
}

if (b_short_int_common_sixtyfive==1)
{

 _theVariable=65;
 
}

if (b_short_int_common_one27==1)
{

 _theVariable=127;
 
}

if (b_short_int_common_one29==1)
{

 _theVariable=129;
 
}

if (b_short_int_common_two55==1)
{

 _theVariable=255;
 
}

if (b_short_int_common_two56==1)
{

 _theVariable=256;
 
}

if (b_short_int_common_two57==1)
{

 _theVariable=257;
 
}

if (b_short_int_common_i4k==1)
{

 _theVariable=4096;
 
}

if (b_short_int_common_i8k==1)
{

 _theVariable=8192;
 
}

if (b_short_int_common_i8193==1)
{

 _theVariable=8193;
 
}

if (b_short_int_common_i16383==1)
{

 _theVariable=16383;
 
}

if (b_short_int_common_maxshort==1)
{
 
 _theVariable=MAXSHORT;
 
}
   return &_theVariable;
}

//--------------------------------------------------------------------
  int CLASSNAME::commit(b_param tname)
{
  if (strcmp(tname,(char *)typeName())!=0)
    return CLASSPARENT::commit(tname);
  //COMMIT CODE HERE
//generated
   return 0;
}

//--------------------------------------------------------------------
  int CLASSNAME::cleanup(b_param tname)
{
  if (strcmp(tname,(char *)typeName())!=0)
    return CLASSPARENT::cleanup(tname);
      
  //CLEANUP CODE
//generated
   return 0;
}

//--------------------------------------------------------------------
int CLASSNAME::numDials(b_param tname)
{
  if (!strcmp(tname,(char *)typeName()))
    return NUMBER_OF_DIALS;
  else return CLASSPARENT::numDials(tname);
      
}


//---------------------------------------------------------------------------
int CLASSNAME::numItems(b_param tname,int dialNumber)
{
  if (strcmp(tname,(char *)typeName())!=0)
    return CLASSPARENT::numItems(tname,dialNumber);
  switch (dialNumber)
    {
      //NUMITEMS SWITCH CASES HERE
      //generated

   case 1:
      return 19;
      break;
//---------------------------------------------------------------------------
      //end generated

    default:
      cerr<<"Error, invalid dial number passed to "
          <<CLASS_STRING<<"::numItems\n"
          <<"Please check declaration files.  Dial number passed was "
          <<dialNumber<<endl;
      exit(1);
    }
  return 0;
}

//---------------------------------------------------------------------------
b_param *CLASSNAME::paramName(b_param tname,
                                   int dialNumber,
                                   int position)

{
  if (strcmp(tname,(char *)typeName())!=0)
    return CLASSPARENT::paramName(tname,dialNumber,position);
  
  switch (dialNumber)
    {
      //PARAMNAME SWITCH CASES HERE
      //generated

case 1:
 switch (position)
   {
      case 1:
         return b_short_int_commonZERO();
         break;
      case 2:
         return b_short_int_commonONE();
         break;
      case 3:
         return b_short_int_commonTWO();
         break;
      case 4:
         return b_short_int_commonFIFTEEN();
         break;
      case 5:
         return b_short_int_commonSIXTEEN();
         break;
      case 6:
         return b_short_int_commonSEVENTEEN();
         break;
      case 7:
         return b_short_int_commonSC_PAGE();
         break;
      case 8:
         return b_short_int_commonSIXTYFOUR();
         break;
      case 9:
         return b_short_int_commonSIXTYFIVE();
         break;
      case 10:
         return b_short_int_commonONE27();
         break;
      case 11:
         return b_short_int_commonONE29();
         break;
      case 12:
         return b_short_int_commonTWO55();
         break;
      case 13:
         return b_short_int_commonTWO56();
         break;
      case 14:
         return b_short_int_commonTWO57();
         break;
      case 15:
         return b_short_int_commonI4K();
         break;
      case 16:
         return b_short_int_commonI8K();
         break;
      case 17:
         return b_short_int_commonI8193();
         break;
      case 18:
         return b_short_int_commonI16383();
         break;
      case 19:
         return b_short_int_commonMAXSHORT();
         break;

      default:
          cerr<<"Error, invalid position number passed to "
              <<CLASS_STRING<<"::paramName\n"
              <<"Please check declaration files.  Dial number passed was"
              <<dialNumber<<" position "<<position<<".\n";
          exit(1);
   }
   break;
    default:
      cerr<<"Error, invalid dial number passed to "
          <<CLASS_STRING<<"::paramName\n"
          <<"Please check declaration files.  Dial number passed was "
          <<dialNumber<<endl;
      exit(1);

    }
  return NULL;
}

//---------------------------------------------------------------------------
