⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 item.h

📁 湖北水文黄石试点集中器代码
💻 H
字号:
#if      !defined(_ITEM34_H)
#define  _ITEM34_H
#include <stdio.h>
//#include "datatype.h"

//#define  ItemOutStrSize		14
#define  ItemOutStrSize		50  //add by wuhuan 2006.6.24
//#define  MaxInputStrSize  10   //add by wuhuan 2006.6.23
/*//////////////////////////////////////////////////////////////////////////
		**** Item class Note ****
   Item class is the base class in CS2092V3.4. Two types of item instance
can be defined upon it, and they are:

	(1) related item: TextStr = NULL
	(2) comment item: TextStr != NULL, which points to a char string;

Many other items can be derived from item class.

   RIdx is a flag for possible related items, it is set with a public
routine by higher user, and used as return value for GetOutStr(). Normally,
RIdx!=0 means that the item is with something which is beyond item's scope,
and higher module, for example menu, having to do something with it. With
using of RIdx, item type classes become much more clear and dignity, no mess
at all.

   The member function OutStrAvailable() is used to tell whether the current
item is a related item which outstring is depends on other item.
	OutStrAvailable( ) == 1:	normal item
	OutStrAvailable( ) == 0:	related item
	OutStrAvailable( ) == 2:	comment item

   The member function DefineItem( ... ) is the base function in class.
User use pValue for item initial value, and pParStruct for relavent para-
meters for the current item modification. User can define various different
parameter structure to create new item easily with C++'s virtual function.

   The member function Value( ... ) is used to return item current value
to higher module. The pointer argument void* can be used to transfer data
structure if necessary.
//////////////////////////////////////////////////////////////////////////*/
class Item
{
protected:
   char* OutStr;			// max ItemOutStrSize permitted
   
   char  Prefix[18];			// max 16 chars permitted
   char  Unit[5];			// max 4 chars permitted
   int   RIdx;				// related item mark
   int   HighLight;			// default = -1;
   void  MakeOutStr( char* VUStr );

public:
   Item( );
   ~Item( );
   void  SetNameUnit( char* PreStr="", char* UnitStr="" );
   void  SetRelation( int RNum ) { RIdx = RNum; }
   int   OutStrAvailable( );
   int   GetHighLight( ) { return HighLight; }
   void  DefineItem( char* TextStr=NULL );
   virtual float Value( void* pParStruct=NULL ) { return 0; };
   virtual void ValueInc( ) { };
   virtual void ValueDec( ) { };
   virtual void ValueINC( ) { };
   virtual void ValueDEC( ) { };
   virtual int  GetOutStr( char* StrBuf );	// return RIdx
   ////////////////add by wuhuan 2006.6.23
   virtual int  PutInStr( char abyte, char mulkeyflg ) { return RIdx; };	// return RIdx
   
};

/*//////////////////////////////////////////////////////////////////////////
		*** Derived class from Item ***

	(1) Item_i:  integer type item class
	(2) Item_l:  long integer type item class
	(3) Item_f:  float type item class
	(4) Item_e:  enum type item class
	(5) Item_w:  wave data type item class
	(6) Item_Fs: sampling rate type item class
	(7) Item_s:  internal trigger slope type item class
	(8) Item_t:  internal trigger level type item class

Each derived class has different parameter structure, which will be defined
below.
//////////////////////////////////////////////////////////////////////////*/

/*////////////////////////////////////////////////////////
	*** Item_e Definition Note ***
   (1) InitV = init value
   (2) pParStruct is never used, just for compatility
   (3) It is recommanded to using (int)A_Item_e.Value( ) to get value
////////////////////////////////////////////////////////*/
class Item_e: public Item
{
   int	  V;
   int    NumStr;
   char** EnumAddr;

public:
   Item_e( );
   ~Item_e( );
   void DefineItem( int EnumIdx, int NumEnum, char** EnumPtr );
   float Value( void* pParStruct=NULL );
   void ValueInc( );
   void ValueDec( );
   void ValueINC( );
   void ValueDEC( );
   int GetOutStr( char* StrBuf );
   int GetV( ) { return V; };
   //add by wuhuan 2006.6.23
   //int  PutInStr( char abyte );
};

 
//add by wuhuan 2006.6.23
/*////////////////////////////////////////////////////////
	*** Item_s Definition Note ***
////////////////////////////////////////////////////////*/
class Item_s: public Item
{
	int  InCharIdx;
	int   NumItem;
  int   ActItem;
  int   MaxInputStrSize;
  char  InputDataBuff[35];
  char  VUStr[40];

public:
   Item_s( );
   ~Item_s( );
   void DefineItem( int Max, char *InitStr );
   float Value( void* pParStruct=NULL );
   void ValueInc( );
   void ValueDec( );
   void ValueINC( );
   void ValueDEC( );
   int GetOutStr( char* StrBuf );
   int PutInStr( char abyte, char mulkeyflg );
   void DeleteAByte(  );
   void GetOutInPutStr( char* StrBuf );
   //void ShowOperInfo( char *StrBuf );
   void ItemInit( );
   
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -