/*
   b_sig_how.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 09:51 PM EDT

TITLE
   b_sig_how.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_sig_how.h"

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


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

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

  //generated

   strcpy(_b_sig_howTYPENAME,CLASS_STRING);
strcpy(_b_sig_howSIGBLOCK,"b_sig_how_SIGBLOCK");
strcpy(_b_sig_howSIGUNBLOCK,"b_sig_how_SIGUNBLOCK");
strcpy(_b_sig_howSIGSETMASK,"b_sig_how_SIGSETMASK");
}

//--------------------------------------------------------------------
b_param *b_sig_how::b_sig_howSIGBLOCK()
{
   return &_b_sig_howSIGBLOCK;
}

b_param *b_sig_how::b_sig_howSIGUNBLOCK()
{
   return &_b_sig_howSIGUNBLOCK;
}

b_param *b_sig_how::b_sig_howSIGSETMASK()
{
   return &_b_sig_howSIGSETMASK;
}

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

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

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
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_sig_how_sigblock = 0;
b_sig_how_sigunblock = 0;
b_sig_how_sigsetmask = 0;
   int dataPTR =0;


   dataPTR++;
if (strcmp(data[dataPTR],_b_sig_howSIGBLOCK)==0)
      b_sig_how_sigblock = 1;
   else if (strcmp(data[dataPTR],_b_sig_howSIGUNBLOCK)==0)
      b_sig_how_sigunblock = 1;
   else if (strcmp(data[dataPTR],_b_sig_howSIGSETMASK)==0)
      b_sig_how_sigsetmask = 1;
  else
    {
      cerr<<"Error: Unknown setting for the "
          <<"HVAL"
          <<" dial of the data object "
          <<CLASS_STRING
          <<". "<<endl
          <<"The offending string is : "
          <<data[dataPTR]
          <<endl;
      exit(1);
    }

if (b_sig_how_sigblock==1)
{

 _theVariable= SIG_BLOCK;
 
}

if (b_sig_how_sigunblock==1)
{
 
 _theVariable= SIG_UNBLOCK; 
 
}

if (b_sig_how_sigsetmask==1)
{
 
 _theVariable= SIG_SETMASK; 
 
}
   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 3;
      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_sig_howSIGBLOCK();
         break;
      case 2:
         return b_sig_howSIGUNBLOCK();
         break;
      case 3:
         return b_sig_howSIGSETMASK();
         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;
}

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