/** @class OutputEventVect @author Brian Magill @date 3/07/2007 $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 returns a vector of data associated with a given table parameter */ //---------------------------------------------------------------------- // #include #include #include "Event.h" #include "GATS_DB.h" #include "GATS_DB_Exception.h" #include "GATS_Utilities.hpp" #include "OutputEventVect.h" //#include "MetaSummary.h" #include "MetaVector.h" #include "ModifyGeneric.h" #include "WritingFactory.h" #include "FindIndependVar.h" #include "EventVarLength.h" #include "GATS_Utilities.hpp" using namespace std; using namespace GATS_Utilities; void OutputEventVect::operator() (std::string tableName) const { string strLog; string ParamName; string strErr; vector > dataArray; unsigned long indxSize; unsigned long i; //int j; int event = L1_Output->getEventNumber(); // MetaSummary metaSum(*L1_Output, *dbConn, metaSumTable); MetaVector metaVect(*L1_Output, *dbConn, metaVectTable); FindIndependVar findIndep(*dbConn, metaSumTable, metaIndepend, metaParamTable); EventVarLength varLength(*L1_Output); WritingFactory factory(*dbConn, metaSumTable, metaStructTable); ModifyGeneric writeOutput; // Only write to table if it stores EventVect objects if (!metaVect.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); } indxSize = varLength(findIndep(tableName)); dataArray = metaVect.getData(tableName); for(i = 0; i < dataArray.size(); i++) { if (dataArray[i].size() != indxSize) { strErr = string("OutputEventVect::operator() : Size of array ") + metaVect.getEntryName(tableName) + string("for signal ") + ConvertToString(i) + " does not match index size"; throw runtime_error(strErr); } writeOutput.insertIntoTable(event, i+1, dataArray[i]); // for (j = 0; j < dataArray[i].size(); j++) // writeOutput.insertIntoTable(event, j+1, i+1, dataArray[i][j]); } }