krTest.cc File Reference

#include <iostream>
#include "KeyRing.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 4 of file krTest.cc.

References KeyRing::addKey(), KeyRing::dump(), KeyRing::floatKey(), KeyRing::intArray(), KeyRing::intKey(), nelements, KeyRing::stringKey(), and KeyRing::write().

00005 {
00006    KeyRing ring ("fish#S=cod;bait#S=maggot;mask#I4=0xff,0x12,0x80,4;") ;
00007 
00008    KeyRing ring2 ("cat#S=oscar;mat#S=floor;winks#I=40;chance#F=99.999") ;
00009 
00010    ring.addKey ("pig", 128) ;
00011    ring.addKey ("pog", 96) ;
00012    ring.addKey ("fog", (float) 75.9) ;
00013    ring.addKey ("poodle", "a dog") ;
00014 
00015    cout << "Dump of ring\n" ;
00016    ring.dump () ;
00017    cout << "Dump of ring2\n" ;
00018    ring2.dump () ;
00019 
00020    cout << "pig is " << ring.intKey ("pig") << endl ;
00021    cout << "fog is " << ring.floatKey ("fog") << endl ;
00022    cout << "poodle is " << ring.stringKey ("poodle") << endl ;
00023 
00024    int mask[8] ;
00025    int* maskPtr = mask ;
00026    int nelements = ring.intArray ("mask", maskPtr,
00027                                   sizeof (mask) / sizeof (int)) ;
00028    cout << "mask is" ;
00029    for (int element = 0 ; element < nelements ; element++) {
00030       cout << "  " << mask[element] ;
00031    }
00032    cout << endl ;
00033 
00034 
00035    cout << "\n\noutput of ring:\n" ;
00036    ring.write () ;
00037 
00038    cout << "\n\noutput of ring2:\n" ;
00039    ring2.write () ;
00040    cout << endl ;
00041 }


Generated on 15 Jul 2018 for loon by  doxygen 1.6.1