/** @class OutputSingleValue @author Brian Magill @date 7/23/2008 $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 Class writes out the single values produced by Level 1 */ //---------------------------------------------------------------------- // #include #include #include "Event.h" #include "GATS_DB.h" #include "GATS_DB_Exception.h" #include "GATS_Utilities.hpp" #include "OutputSingleValue.h" #include "MetaSingleValue.h" #include "ModifyGeneric.h" #include "WritingFactory.h" #include "GATS_Utilities.hpp" using namespace std; using namespace GATS_Utilities; void OutputSingleValue::operator() (std::string tableName) const { string strLog; string ParamName; string strErr; vector paramList; double dataValue; unsigned long i; //unsigned long j; int event = L1_Output->getEventNumber(); MetaSingleValue metaValue(*L1_Output, *dbConn, metaValueTable); WritingFactory factory(*dbConn, metaSumTable, metaStructTable); ModifyGeneric writeOutput; // Only write to table if it stores EventVar objects if (!metaValue.TableExists(tableName) ) return; writeOutput = factory(tableName); strLog = string("writing to table: ") + tableName; L1_Output->addLogEntry(strLog); if (writeOutput.eventExists(event) ) { strLog = string("Warning: overwriting data for event ") + ConvertToString(event) + string(" in table ") + tableName; cerr << strLog << endl; L1_Output->addLogEntry(strLog); writeOutput.deleteEvent(event); } paramList = metaValue.getParameterList(tableName); for(i = 0; i < paramList.size(); i++) { dataValue = metaValue.getData(tableName, paramList[i]); writeOutput.insertIntoTable(event, paramList[i], dataValue); } }