/*
   b_ptr_float.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:49 AM EDT

TITLE
   b_ptr_float.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_float.h"

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


 static float temp_float;
 //--------------------------------------------------------------------

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

  //generated

   strcpy(_b_ptr_floatTYPENAME,CLASS_STRING);
strcpy(_b_ptr_floatFMINEXP,"b_ptr_float_FMINEXP");
strcpy(_b_ptr_floatLN2,"b_ptr_float_LN2");
strcpy(_b_ptr_floatPI,"b_ptr_float_PI");
strcpy(_b_ptr_floatHALF_PI,"b_ptr_float_HALF_PI");
strcpy(_b_ptr_floatTWO_PI,"b_ptr_float_TWO_PI");
strcpy(_b_ptr_floatSQRT2,"b_ptr_float_SQRT2");
strcpy(_b_ptr_floatE,"b_ptr_float_E");
strcpy(_b_ptr_floatMAXFLOAT,"b_ptr_float_MAXFLOAT");
strcpy(_b_ptr_floatMINFLOAT,"b_ptr_float_MINFLOAT");
strcpy(_b_ptr_floatNEGMAXFLOAT,"b_ptr_float_NEGMAXFLOAT");
strcpy(_b_ptr_floatNEGMINFLOAT,"b_ptr_float_NEGMINFLOAT");
strcpy(_b_ptr_floatZERO,"b_ptr_float_ZERO");
strcpy(_b_ptr_floatNEGONE,"b_ptr_float_NEGONE");
strcpy(_b_ptr_floatONE,"b_ptr_float_ONE");
}

//--------------------------------------------------------------------
b_param *b_ptr_float::b_ptr_floatFMINEXP()
{
   return &_b_ptr_floatFMINEXP;
}

b_param *b_ptr_float::b_ptr_floatLN2()
{
   return &_b_ptr_floatLN2;
}

b_param *b_ptr_float::b_ptr_floatPI()
{
   return &_b_ptr_floatPI;
}

b_param *b_ptr_float::b_ptr_floatHALF_PI()
{
   return &_b_ptr_floatHALF_PI;
}

b_param *b_ptr_float::b_ptr_floatTWO_PI()
{
   return &_b_ptr_floatTWO_PI;
}

b_param *b_ptr_float::b_ptr_floatSQRT2()
{
   return &_b_ptr_floatSQRT2;
}

b_param *b_ptr_float::b_ptr_floatE()
{
   return &_b_ptr_floatE;
}

b_param *b_ptr_float::b_ptr_floatMAXFLOAT()
{
   return &_b_ptr_floatMAXFLOAT;
}

b_param *b_ptr_float::b_ptr_floatMINFLOAT()
{
   return &_b_ptr_floatMINFLOAT;
}

b_param *b_ptr_float::b_ptr_floatNEGMAXFLOAT()
{
   return &_b_ptr_floatNEGMAXFLOAT;
}

b_param *b_ptr_float::b_ptr_floatNEGMINFLOAT()
{
   return &_b_ptr_floatNEGMINFLOAT;
}

b_param *b_ptr_float::b_ptr_floatZERO()
{
   return &_b_ptr_floatZERO;
}

b_param *b_ptr_float::b_ptr_floatNEGONE()
{
   return &_b_ptr_floatNEGONE;
}

b_param *b_ptr_float::b_ptr_floatONE()
{
   return &_b_ptr_floatONE;
}

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

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

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
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_float_fminexp = 0;
b_ptr_float_ln2 = 0;
b_ptr_float_pi = 0;
b_ptr_float_half_pi = 0;
b_ptr_float_two_pi = 0;
b_ptr_float_sqrt2 = 0;
b_ptr_float_e = 0;
b_ptr_float_maxfloat = 0;
b_ptr_float_minfloat = 0;
b_ptr_float_negmaxfloat = 0;
b_ptr_float_negminfloat = 0;
b_ptr_float_zero = 0;
b_ptr_float_negone = 0;
b_ptr_float_one = 0;
   int dataPTR =0;


   dataPTR++;
if (strcmp(data[dataPTR],_b_ptr_floatFMINEXP)==0)
      b_ptr_float_fminexp = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatLN2)==0)
      b_ptr_float_ln2 = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatPI)==0)
      b_ptr_float_pi = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatHALF_PI)==0)
      b_ptr_float_half_pi = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatTWO_PI)==0)
      b_ptr_float_two_pi = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatSQRT2)==0)
      b_ptr_float_sqrt2 = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatE)==0)
      b_ptr_float_e = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatMAXFLOAT)==0)
      b_ptr_float_maxfloat = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatMINFLOAT)==0)
      b_ptr_float_minfloat = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatNEGMAXFLOAT)==0)
      b_ptr_float_negmaxfloat = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatNEGMINFLOAT)==0)
      b_ptr_float_negminfloat = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatZERO)==0)
      b_ptr_float_zero = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatNEGONE)==0)
      b_ptr_float_negone = 1;
   else if (strcmp(data[dataPTR],_b_ptr_floatONE)==0)
      b_ptr_float_one = 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_ptr_float_fminexp==1)
{

 temp_float = FMINEXP; 
 
}

if (b_ptr_float_ln2==1)
{

 temp_float = M_LN2; 
 
}

if (b_ptr_float_pi==1)
{

 temp_float = M_PI;
 
}

if (b_ptr_float_half_pi==1)
{

 temp_float = M_PI_2; 
 
}

if (b_ptr_float_two_pi==1)
{

 temp_float = M_PI * 2.0; 
 
}

if (b_ptr_float_sqrt2==1)
{

 temp_float= M_SQRT2;
 
}

if (b_ptr_float_e==1)
{

 temp_float = M_E; 
 
}

if (b_ptr_float_maxfloat==1)
{

 temp_float = MAXFLOAT;
 
}

if (b_ptr_float_minfloat==1)
{

 temp_float = MINFLOAT;
 
}

if (b_ptr_float_negmaxfloat==1)
{

 temp_float = -MAXFLOAT;
 
}

if (b_ptr_float_negminfloat==1)
{

 temp_float = -MINDOUBLE;
 
}

if (b_ptr_float_zero==1)
{

 temp_float = 0.0;
 
}

if (b_ptr_float_negone==1)
{

 temp_float = -1.0;
 
}

if (b_ptr_float_one==1)
{

 temp_float = 1.0;
 
}

 _theVariable = &temp_float;
   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 14;
      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_floatFMINEXP();
         break;
      case 2:
         return b_ptr_floatLN2();
         break;
      case 3:
         return b_ptr_floatPI();
         break;
      case 4:
         return b_ptr_floatHALF_PI();
         break;
      case 5:
         return b_ptr_floatTWO_PI();
         break;
      case 6:
         return b_ptr_floatSQRT2();
         break;
      case 7:
         return b_ptr_floatE();
         break;
      case 8:
         return b_ptr_floatMAXFLOAT();
         break;
      case 9:
         return b_ptr_floatMINFLOAT();
         break;
      case 10:
         return b_ptr_floatNEGMAXFLOAT();
         break;
      case 11:
         return b_ptr_floatNEGMINFLOAT();
         break;
      case 12:
         return b_ptr_floatZERO();
         break;
      case 13:
         return b_ptr_floatNEGONE();
         break;
      case 14:
         return b_ptr_floatONE();
         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;
}

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