//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / pfFrame
//
//File: fr_test.cpp
//
//Version: $Revision: 1.1 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/06/03 10:09:45 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Authors:
//      Sami Raatikainen
// 
//Description:
//
//
//Copyright:
//
//      
//Licence:
//     
//
//History:
//
// 

#include "frame.h"
#include <iostream.h>
#include <typeinfo>
//#include "/home/raatikai/src/pf/exception.h"

int main(void)
{
    
    pfFrame f(10);
    
    for(pfUlong i=0; i<10; i++)
        f.putFirst32bit(i);
    for(pfUlong i=0; i<10; i++)
        f.putFirst24bit(i);
    for(pfUlong i=0; i<10; i++)
        f.putFirst16bit(i);
    for(pfUlong i=0; i<10; i++)
        f.putFirst((pfByte)i);
    
    try
    {
        for(pfUlong i=0; i<10; i++)
            cout << f.getLast32bit() << " ";
        for(pfUlong i=0; i<10; i++)
            cout << f.getLast24bit() << " ";
        for(pfUlong i=0; i<10; i++)
            cout << f.getLast16bit() << " ";
        for(pfUlong i=0; i<10; i++)
            cout << (pfUlong)f.getLast() << " ";
    }
    catch(pfException &ex)
    {
        ex.printInfo();
        delete (pfException*)&ex;
    }
    cout << endl;
    
    for(pfUlong i=0; i<10; i++)
        f.putLast32bit(i);
    for(pfUlong i=0; i<10; i++)
        f.putLast24bit(i);
    for(pfUlong i=0; i<10; i++)
        f.putLast16bit(i);
    for(pfUlong i=0; i<10; i++)
        f.putLast((pfByte)i);
    
    try
    {
        for(pfUlong i=0; i<10; i++)
            cout << f.getFirst32bit() << " ";
        for(pfUlong i=0; i<10; i++)
            cout << f.getFirst24bit() << " ";
        for(pfUlong i=0; i<10; i++)
            cout << f.getFirst16bit() << " ";
        for(pfUlong i=0; i<10; i++)
            cout << (pfUlong)f.getFirst() << " "; 
    }
    catch(pfException &ex)
    {
        ex.printInfo();
        delete (pfException*)&ex;
    }
    
    cout << "f length: " << f.length() << endl;

    /*
      cout << "\ne length: " << e.length() << endl;
      for(int i=1; i<200; i++){
      cout << e.getLast16bit() << " ";
      cout.flush();
      }
      cout << "\ne length: " << e.length() << endl;
      */
    
//    cout << (pfUlong)f.getLast();
    
    /*  
        cout << "putFirst16bit(111)" << endl; f.putFirst16bit(111);
        cout << "putFirst32bit(1023)" << endl; f.putFirst32bit(1023);
        cout << "putLast24bit(255)" << endl; f.putLast24bit(255);
        
        cout << "length: " << f.length() << endl;
        
        pfFrame e(f);
        cout << "read(3)      " << (pfUlong)e.read(3) << endl;
        cout << "read16bit(2) " << e.read16bit(2) << endl;
        cout << "read24bit(1) " << e.read24bit(1) << endl;
        cout << "read32bit()  " << e.read32bit() << endl;
        cout << "length: " << e.length() << endl;
        

        cout << "getFirst32bit() " << f.getFirst32bit() << endl;
        cout << "getLast24bit() " << f.getLast24bit() << endl;
        cout << "getFirst16bit() " << f.getFirst16bit() << endl;
        
        cout << "putLast32bit(2047)" << endl; f.putLast32bit(2047);
        cout << "putLast16bit(1023)" << endl; f.putLast16bit(1023);   
        cout << "putLast24bit(255)" << endl; f.putLast24bit(255); 
        cout << "putLast32bit(111)" << endl; f.putLast32bit(111); 
        cout << "length: " << f.length() << endl;
        
        cout << "getFirst32bit() " << f.getFirst32bit() << endl;
        cout << "getFirst16bit() " << f.getFirst16bit() << endl;
        cout << "getFirst24bit() " << f.getFirst24bit() << endl;
        cout << "getFirst32bit() " << f.getFirst32bit() << endl;
        */
    
    return 0;
}


