window_shapes.cpp
上传用户:jtjnyq9001
上传日期:2014-11-21
资源大小:3974k
文件大小:2k
源码类别:

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = window_shapes.cpp
  3. //
  4. #include <stdlib.h>
  5. //#include <fstream>
  6. #include <string.h>
  7. #include "parmfile.h"
  8. #include "window_shapes.h"
  9. #include "psstream.h"
  10. extern ParmFile *ParmInput;
  11. //======================================================
  12. WINDOW_SHAPE_T GetWindowShapeParm(const char* parm_nam)
  13. {
  14.   char parm_str[30];
  15.   if(ParmInput->GetParmStr(parm_nam, parm_str)!=0)
  16.     {
  17.     ParmInput->RestartBlock();
  18.     if(ParmInput->GetParmStr(parm_nam, parm_str) !=0)
  19.       {
  20.       ErrorStream <<  "Error: parameter '" << parm_nam 
  21.                   << "' not found after 2 attempts" << endl;
  22.       exit(-1);
  23.       }
  24.     }
  25.   if(!strcmp(parm_str,"WINDOW_SHAPE_TRIANGULAR")) return(WINDOW_SHAPE_TRIANGULAR);
  26.   if(!strcmp(parm_str,"WINDOW_SHAPE_HAMMING")) return(WINDOW_SHAPE_HAMMING);
  27.   if(!strcmp(parm_str,"WINDOW_SHAPE_HANN")) return(WINDOW_SHAPE_HANN);
  28.   ErrorStream <<  "Error: '" << parm_str 
  29.               << "' is not a legal value for type WINDOW_SHAPE_T" << endl;
  30.   exit(-1);
  31. }
  32. ostream& operator<<( ostream& s, const WINDOW_SHAPE_T& win_shape_val)
  33. {
  34.   switch (win_shape_val)
  35.     {
  36.     case WINDOW_SHAPE_TRIANGULAR:
  37.       s << "WINDOW_SHAPE_TRIANGULAR";
  38.       break;
  39.     case WINDOW_SHAPE_HAMMING:
  40.       s << "WINDOW_SHAPE_HAMMING";
  41.       break;
  42.     case WINDOW_SHAPE_HANN:
  43.       s << "WINDOW_SHAPE_HANN";
  44.       break;
  45.     default:
  46.       s << "unknown WINDOW_SHAPE_T";
  47.     } // end of switch on win_shape_val
  48.  return s;
  49. }
  50. PracSimStream& operator<<( PracSimStream& s, const WINDOW_SHAPE_T& win_shape_val)
  51. {
  52.   switch (win_shape_val)
  53.     {
  54.     case WINDOW_SHAPE_TRIANGULAR:
  55.       s << "WINDOW_SHAPE_TRIANGULAR";
  56.       break;
  57.     case WINDOW_SHAPE_HAMMING:
  58.       s << "WINDOW_SHAPE_HAMMING";
  59.       break;
  60.     case WINDOW_SHAPE_HANN:
  61.       s << "WINDOW_SHAPE_HANN";
  62.       break;
  63.     default:
  64.       s << "unknown WINDOW_SHAPE_T";
  65.     } // end of switch on win_shape_val
  66.  return s;
  67. }