next up previous contents
Next: Bank Types Up: Bank Keys Previous: Initialization

Tests and Accessors

The general tests of validity and equality are provided. For example,

TRY_Bank_Key no_key ;           // default constructor puts it into invalid state
if (no_key.is_invalid())
  {  // yes, no_key is invalid
  }

TRY_Bank_Key LRID_key("LRID",1) ;
TRY_Bank_Key CMUO_key("CMUO",5) ;
if (LRID_key != CMUO_key)
  {  // Of course, they are not equal
  }

TRY_Bank_Key CMUO_any("CMUO") ;
TRY_Bank_Key CMUO_key("CMUO",5) ;
if (CMUO_any == CMUO_key)
  {  // Due to implied number wildcard in CMUO_any, they are equal
  }

TRY_Bank_Key null_key ; // default goes invalid state, implies number nullcard
TRY_Bank_Key CMUO_key("CMUO",5) ;
if (null_key != CMUO_key)
  {  // Due to nullcard, they are not equal
  }

There are also tests for exactness (value is not a wildcard or a special value) is_exact() and is_inexact() in TRY_Bank_Key. A bank key is exact only if both its key and number parts are exact, otherwise it is inexact.

One can access the bank key or bank number part of the bank key, or pretty-print both parts as a pair with

my_name   = my_key.bank_name() ;      // get the bank name
my_number = my_key.bank_number() ;    // get the bank number
cout << my_bank_key() ;               // method defined to output formatted key



Robert Kennedy
Mon Jul 28 13:23:28 CDT 1997