/** @file AlgorithmFactory.cpp @author Brian Magill @date 11/29/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 Class for creating different types of algorithm objects Initially it was envisioned that there might be several signal corrections with the functional form, signal = Function(signal). Almost all of these are now being modelled during Level 2 processing or have been incorporated into other processing code. */ #include "AlgorithmFactory.h" #include "NoOpAlgorithm.h" //#include "BalanceAlgorithm.h" #include "GainAlgorithm.h" #include #include //#include #include #include using namespace std; using namespace boost; //using namespace SigFactory; AlgorithmFactory& AlgorithmFactory::operator= (AlgorithmFactory const &rhs) { if(this == &rhs) return *this; dataConn = rhs.dataConn; return *this; } shared_ptr AlgorithmFactory:: create(SigFactory::AlgoTypes const & atype) const { // vector gain; shared_ptr algoPtr; if(!dataConn->isConnected()) {throw runtime_error("Error in AlgorithmFactory::create(). No data connection! "); } try { switch(atype) { // case SigFactory::ElecFilter: // algoPtr = shared_ptr // (new NoOpAlgorithm("Electronic Filter Placeholder")); // break; // case SigFactory::Balance: // algoPtr = shared_ptr // (new BalanceAlgorithm( ) ); // break; case SigFactory::Gain: algoPtr = shared_ptr (new GainAlgorithm(dataConn->getDiffGainParam()) ); break; case SigFactory::FOVMM: algoPtr = shared_ptr (new NoOpAlgorithm("FOVMM Placeholder")); break; // case SigFactory::Confidence: // algoPtr = shared_ptr // (new NoOpAlgorithm("Signal Confidence Placeholder")); // break; // // case SigFactory::NonLin: // algoPtr = shared_ptr // (new NoOpAlgorithm("Nonlinearity Placeholder")); // break; default: algoPtr = shared_ptr (new NoOpAlgorithm("Unknown, Check code for new type!")); break; } } catch (std::exception &ex) { cerr << "Exception encountered in AlgorithmFactory: " << ex.what() << endl; cerr << "Rethrow to calling routine" << endl; throw; } return algoPtr; }