/*
   b_ptr_sigevent.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 Wednesday, May 23 at 02:56 AM EDT

TITLE
   b_ptr_sigevent.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_ptr_sigevent.h"

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


 static struct sigevent sigEvent;
//--------------------------------------------------------------------

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

  //generated

   strcpy(_b_ptr_sigeventTYPENAME,CLASS_STRING);
strcpy(_b_ptr_sigeventNOTIFY_ZERO,"b_ptr_sigevent_NOTIFY_ZERO");
strcpy(_b_ptr_sigeventNOTIFY_MAXINT,"b_ptr_sigevent_NOTIFY_MAXINT");
strcpy(_b_ptr_sigeventNOTIFY_MININT,"b_ptr_sigevent_NOTIFY_MININT");
strcpy(_b_ptr_sigeventNOTIFY_NEGONE,"b_ptr_sigevent_NOTIFY_NEGONE");
strcpy(_b_ptr_sigeventNOTIFY_ONE,"b_ptr_sigevent_NOTIFY_ONE");
strcpy(_b_ptr_sigeventNOTIFY_NONE,"b_ptr_sigevent_NOTIFY_NONE");
strcpy(_b_ptr_sigeventNOTIFY_SIGNAL,"b_ptr_sigevent_NOTIFY_SIGNAL");
strcpy(_b_ptr_sigeventSIGABRT,"b_ptr_sigevent_SIGABRT");
strcpy(_b_ptr_sigeventSIGINT,"b_ptr_sigevent_SIGINT");
strcpy(_b_ptr_sigeventSIGILL,"b_ptr_sigevent_SIGILL");
strcpy(_b_ptr_sigeventSIGSEGV,"b_ptr_sigevent_SIGSEGV");
strcpy(_b_ptr_sigeventSIGRTMIN,"b_ptr_sigevent_SIGRTMIN");
strcpy(_b_ptr_sigeventSIGRTMAX,"b_ptr_sigevent_SIGRTMAX");
strcpy(_b_ptr_sigeventMAXINT,"b_ptr_sigevent_MAXINT");
strcpy(_b_ptr_sigeventMININT,"b_ptr_sigevent_MININT");
strcpy(_b_ptr_sigeventZERO,"b_ptr_sigevent_ZERO");
strcpy(_b_ptr_sigeventONE,"b_ptr_sigevent_ONE");
strcpy(_b_ptr_sigeventNEGONE,"b_ptr_sigevent_NEGONE");
}

//--------------------------------------------------------------------
b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_ZERO()
{
   return &_b_ptr_sigeventNOTIFY_ZERO;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_MAXINT()
{
   return &_b_ptr_sigeventNOTIFY_MAXINT;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_MININT()
{
   return &_b_ptr_sigeventNOTIFY_MININT;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_NEGONE()
{
   return &_b_ptr_sigeventNOTIFY_NEGONE;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_ONE()
{
   return &_b_ptr_sigeventNOTIFY_ONE;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_NONE()
{
   return &_b_ptr_sigeventNOTIFY_NONE;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNOTIFY_SIGNAL()
{
   return &_b_ptr_sigeventNOTIFY_SIGNAL;
}

b_param *b_ptr_sigevent::b_ptr_sigeventSIGABRT()
{
   return &_b_ptr_sigeventSIGABRT;
}

b_param *b_ptr_sigevent::b_ptr_sigeventSIGINT()
{
   return &_b_ptr_sigeventSIGINT;
}

b_param *b_ptr_sigevent::b_ptr_sigeventSIGILL()
{
   return &_b_ptr_sigeventSIGILL;
}

b_param *b_ptr_sigevent::b_ptr_sigeventSIGSEGV()
{
   return &_b_ptr_sigeventSIGSEGV;
}

b_param *b_ptr_sigevent::b_ptr_sigeventSIGRTMIN()
{
   return &_b_ptr_sigeventSIGRTMIN;
}

b_param *b_ptr_sigevent::b_ptr_sigeventSIGRTMAX()
{
   return &_b_ptr_sigeventSIGRTMAX;
}

b_param *b_ptr_sigevent::b_ptr_sigeventMAXINT()
{
   return &_b_ptr_sigeventMAXINT;
}

b_param *b_ptr_sigevent::b_ptr_sigeventMININT()
{
   return &_b_ptr_sigeventMININT;
}

b_param *b_ptr_sigevent::b_ptr_sigeventZERO()
{
   return &_b_ptr_sigeventZERO;
}

b_param *b_ptr_sigevent::b_ptr_sigeventONE()
{
   return &_b_ptr_sigeventONE;
}

b_param *b_ptr_sigevent::b_ptr_sigeventNEGONE()
{
   return &_b_ptr_sigeventNEGONE;
}

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

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

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
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_ptr_sigevent_notify_zero = 0;
b_ptr_sigevent_notify_maxint = 0;
b_ptr_sigevent_notify_minint = 0;
b_ptr_sigevent_notify_negone = 0;
b_ptr_sigevent_notify_one = 0;
b_ptr_sigevent_notify_none = 0;
b_ptr_sigevent_notify_signal = 0;
b_ptr_sigevent_sigabrt = 0;
b_ptr_sigevent_sigint = 0;
b_ptr_sigevent_sigill = 0;
b_ptr_sigevent_sigsegv = 0;
b_ptr_sigevent_sigrtmin = 0;
b_ptr_sigevent_sigrtmax = 0;
b_ptr_sigevent_maxint = 0;
b_ptr_sigevent_minint = 0;
b_ptr_sigevent_zero = 0;
b_ptr_sigevent_one = 0;
b_ptr_sigevent_negone = 0;
   int dataPTR =0;


   dataPTR++;
if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_ZERO)==0)
      b_ptr_sigevent_notify_zero = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_MAXINT)==0)
      b_ptr_sigevent_notify_maxint = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_MININT)==0)
      b_ptr_sigevent_notify_minint = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_NEGONE)==0)
      b_ptr_sigevent_notify_negone = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_ONE)==0)
      b_ptr_sigevent_notify_one = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_NONE)==0)
      b_ptr_sigevent_notify_none = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNOTIFY_SIGNAL)==0)
      b_ptr_sigevent_notify_signal = 1;
  else
    {
      cerr<<"Error: Unknown setting for the "
          <<"NOTIFY"
          <<" dial of the data object "
          <<CLASS_STRING
          <<". "<<endl
          <<"The offending string is : "
          <<data[dataPTR]
          <<endl;
      exit(1);
    }

   dataPTR++;
if (strcmp(data[dataPTR],_b_ptr_sigeventSIGABRT)==0)
      b_ptr_sigevent_sigabrt = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventSIGINT)==0)
      b_ptr_sigevent_sigint = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventSIGILL)==0)
      b_ptr_sigevent_sigill = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventSIGSEGV)==0)
      b_ptr_sigevent_sigsegv = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventSIGRTMIN)==0)
      b_ptr_sigevent_sigrtmin = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventSIGRTMAX)==0)
      b_ptr_sigevent_sigrtmax = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventMAXINT)==0)
      b_ptr_sigevent_maxint = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventMININT)==0)
      b_ptr_sigevent_minint = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventZERO)==0)
      b_ptr_sigevent_zero = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventONE)==0)
      b_ptr_sigevent_one = 1;
   else if (strcmp(data[dataPTR],_b_ptr_sigeventNEGONE)==0)
      b_ptr_sigevent_negone = 1;
  else
    {
      cerr<<"Error: Unknown setting for the "
          <<"SIGNO"
          <<" dial of the data object "
          <<CLASS_STRING
          <<". "<<endl
          <<"The offending string is : "
          <<data[dataPTR]
          <<endl;
      exit(1);
    }

if (b_ptr_sigevent_notify_zero==1)
{

 sigEvent.sigev_notify = 0;
 
}

if (b_ptr_sigevent_notify_maxint==1)
{

 sigEvent.sigev_notify = MAXINT;
 
}

if (b_ptr_sigevent_notify_minint==1)
{

 sigEvent.sigev_notify = -MAXINT;
 
}

if (b_ptr_sigevent_notify_negone==1)
{

 sigEvent.sigev_notify = -1;
 
}

if (b_ptr_sigevent_notify_one==1)
{

 sigEvent.sigev_notify = 1;
 
}

if (b_ptr_sigevent_notify_none==1)
{

 sigEvent.sigev_notify = SIGEV_NONE;
 
}

if (b_ptr_sigevent_notify_signal==1)
{

 sigEvent.sigev_notify = SIGEV_SIGNAL;
 
}

if (b_ptr_sigevent_sigabrt==1)
{

 sigEvent.sigev_signo = SIGABRT;
 
}

if (b_ptr_sigevent_sigint==1)
{

 sigEvent.sigev_signo = SIGINT;
 
}

if (b_ptr_sigevent_sigill==1)
{

 sigEvent.sigev_signo = SIGILL;
 
}

if (b_ptr_sigevent_sigsegv==1)
{

 sigEvent.sigev_signo = SIGSEGV;
 
}

if (b_ptr_sigevent_sigrtmin==1)
{

 sigEvent.sigev_signo = SIGRTMIN;
 
}

if (b_ptr_sigevent_sigrtmax==1)
{

 sigEvent.sigev_signo = SIGRTMAX;
 
}

if (b_ptr_sigevent_maxint==1)
{

 sigEvent.sigev_signo = MAXINT;
 
}

if (b_ptr_sigevent_minint==1)
{
 
 sigEvent.sigev_signo = -MAXINT;
 
}

if (b_ptr_sigevent_zero==1)
{

 sigEvent.sigev_signo = 0;
 
}

if (b_ptr_sigevent_one==1)
{

 sigEvent.sigev_signo = 1;
 
}

if (b_ptr_sigevent_negone==1)
{

 sigEvent.sigev_signo = -1;
 
}

 _theVariable=&sigEvent;
   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 7;
      break;

   case 2:
      return 11;
      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_ptr_sigeventNOTIFY_ZERO();
         break;
      case 2:
         return b_ptr_sigeventNOTIFY_MAXINT();
         break;
      case 3:
         return b_ptr_sigeventNOTIFY_MININT();
         break;
      case 4:
         return b_ptr_sigeventNOTIFY_NEGONE();
         break;
      case 5:
         return b_ptr_sigeventNOTIFY_ONE();
         break;
      case 6:
         return b_ptr_sigeventNOTIFY_NONE();
         break;
      case 7:
         return b_ptr_sigeventNOTIFY_SIGNAL();
         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;

case 2:
 switch (position)
   {
      case 1:
         return b_ptr_sigeventSIGABRT();
         break;
      case 2:
         return b_ptr_sigeventSIGINT();
         break;
      case 3:
         return b_ptr_sigeventSIGILL();
         break;
      case 4:
         return b_ptr_sigeventSIGSEGV();
         break;
      case 5:
         return b_ptr_sigeventSIGRTMIN();
         break;
      case 6:
         return b_ptr_sigeventSIGRTMAX();
         break;
      case 7:
         return b_ptr_sigeventMAXINT();
         break;
      case 8:
         return b_ptr_sigeventMININT();
         break;
      case 9:
         return b_ptr_sigeventZERO();
         break;
      case 10:
         return b_ptr_sigeventONE();
         break;
      case 11:
         return b_ptr_sigeventNEGONE();
         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;
}

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