next up previous contents
Next: Tests and Accessors Up: GenericNamed, and Specific Previous: GenericNamed, and Specific

Initialization

Recorded and unrecorded banks are initialized differently. Recorded banks are usually created given another recorded bank, a record iterator, or (key, type, record pointer) information as the initializer.

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

TRY_Generic_Bank copy_of_bank(other_bank) ;     // copy constructor
if (copy_of_bank.is_recorded())
  {  // copy_of_bank will be recorded if other_bank is recorded
  }

TRY_Generic_Bank iter_bank(my_iter_any) ;       // my_iter_same can be used, too
if (iter_bank.is_valid())
  {  // check to be sure record iterator led to valid bank initialization
  }

TRY_Generic_Bank appended_bank(bank_key,bank_type,p_record) ;
if (appended_bank.is_valid())
  {  // initialize recorded bank, append to end of record
  }

Unrecorded banks, however, do not require information about a particular record or iterator in order to be initialized. Hence one can only copy an unrecorded bank or create an unrecorded bank by supplying the bank key and bank type initializers.

TRY_Generic_Bank copy_of_bank(other_bank) ;        // copy constructor
if (copy_of_bank.is_invalid())
  {  // yes, copy_of_bank is invalid
  }

TRY_Generic_Bank unrecorded_bank(bank_key,bank_type) ;
if (unrecorded_bank.is_valid())
  {  // initialize unrecorded_bank to be dynamically allocated
  }



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