/*****************************************************************************
* Copyright (c) 1990-98 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/


// ValueMap.h: 
//
//////////////////////////////////////////////////////////////////////

#if !defined(VALUEMAP_H)
#define VALUEMAP_H

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

struct SValueMap
{
   enum
   {
      MAP_UNKNOWN = -1,
      MAP_CT1_WINKDIGITS,
      MAP_CT1_SIGNALING,
      MAP_PRI_SWITCH,
	  MAP_E1_SWITCH,
	  MAP_E1R2_SWITCH,

      MAP_BRI_SWITCH,

      MAP_DCHAN_ADDRTYPE,
      MAP_DCHAN_NUMPLAN,
      MAP_DCHAN_SUBADDRTYPE,

	  MAP_E1R2_R2SWITCHTYPE,
	  MAP_E1R2_CD_BITS,
	  MAP_E1R2_MAXDNISDIGITS,
	  MAP_E1R2_MINDNISDIGITS,
	  MAP_E1R2_MAXANIDIGITS,
	  MAP_E1R2_MINANIDIGITS,
	  MAP_E1R2_SENDANIDIGITS,
	  MAP_E1R2_ANIDIGITSIGNAL,
	  MAP_E1R2_ANSWERSIGNAL,
      MAP_E1R2_BUSYSIGNAL,
	  MAP_E1R2_OUTGOINGTYPE,
	  MAP_E1R2_ENDDNISSIGNAL,

      MAP_COUNT,
   };

   enum
   {
      MAP_TYPE_UNKNOWN = -1,
      MAP_TYPE_STR2DWORD,
      MAP_TYPE_INTRANGE,
      MAP_TYPE_COUNT,
   };

   SValueMap() { eMapType = MAP_TYPE_UNKNOWN; adwValues.RemoveAll(); astrDisplayNames.RemoveAll(); nMin = 0; nMax = 0; }
   SValueMap(int const eValueMap) { Init(eValueMap); }
   BOOL Init(int const eValueMap);
   
   ~SValueMap() { }

   int ToIndex(DWORD const dwValue, int const iDefault = -1);
   DWORD FromIndex(int const iIndex);

   CString DisplayNameFromValue(DWORD const dwValue);

   // For string to dword maps only!
   CDWordArray adwValues;
   CStringArray astrDisplayNames;

   // For integer range maps only!
   int nMin;
   int nMax;

private:
   int eMapType;
};

#endif // VALUEMAP_H
