/**
    @file OutputSOFIE_Summary.cpp
    @author Brian Magill
    @creation date 9/13/2006

	$Date:$
    $Revision:$

    @copyright
     (©) Copyright 2006 by GATS Inc.
     11864 Canon Blvd., Suite 101, Newport News, VA 23606

     All Rights Reserved. No part of this software or publication may be
     reproduced, stored in a retrieval system, or transmitted, in any form
     or by any means, electronic, mechanical, photocopying, recording, or
     otherwise without the prior written permission of GATS Inc.
    
    @brief base class for extracting information from an Event Class
    
*/
#include "OutputSOFIE_Summary.h"

using namespace std;

// void OutputSOFIE_Summary::operator() (Event const &inEvent)
void OutputSOFIE_Summary::operator() (Event &inEvent)
    {

    long event_num = inEvent.getEventNumber();
    long orbit = inEvent.getOrbitNumber();
    char mode = inEvent.getSRSSFlag();
    long start_time = static_cast<long>(inEvent.getEventStartTime() );     
    long end_time =  static_cast<long>(inEvent.getEventStopTime() );     
    long start_occ =  static_cast<long>(inEvent.getAtmosStartTime() );    
    long end_occ =  static_cast<long>(inEvent.getAtmosStopTime() );     
    long start_scan =  static_cast<long>(inEvent.getSolarScanStartTime() );
    long end_scan =  static_cast<long>(inEvent.getSolarScanStopTime() ); 
    float latitude = inEvent.getLatitude83km();      
    float longitude = inEvent.getLongitude83km();     
    
    if( !SummaryTable.eventExists(event_num))
        {
        SummaryTable.insertIntoTable(event_num, orbit,  start_time, end_time, 
                                    start_occ, end_occ, 
                                    start_scan, end_scan, mode,
                                    latitude, longitude,
                                    procTime, Level0_ID, Version);
        
        }    
    else
        {
        SummaryTable.updateTable(event_num, orbit, start_time, end_time, 
                                start_occ, end_occ,
                                start_scan, end_scan, mode,
                                latitude, longitude,
                                procTime, Level0_ID, Version);
        
        }    

    };