/** @class FilterTSample.cpp @author Brian Magill @datecreated 3/24/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 Temperatures of SCM filter holders for a given instant */ //---------------------------------------------------------------------- // #include #include #include "FilterTSample.h" //#include "SOFIE_Exception.h" using namespace SOFIE; //using namespace blitz; using namespace std; FilterTSample::FilterTSample(double tim, std::valarray temper ) { time = tim; int len = temper.size(); if(len == Num_of_SCMF) { Temperatures.resize(len); Temperatures = temper; } else throw runtime_error("FilterTSample Constructor: temperature array has wrong size"); } FilterTSample::FilterTSample(const FilterTSample& rhs ) { time = rhs.time; Temperatures.resize(rhs.Temperatures.size() ); for(int i = 0; i < Num_of_SCMF; i++) Temperatures[i] = rhs.Temperatures[i]; } FilterTSample& FilterTSample::operator = (const FilterTSample& rhs ) { if (this == &rhs) return *this; time = rhs.time; Temperatures.resize(rhs.Temperatures.size() ); for(int i = 0; i < Num_of_SCMF; i++) Temperatures[i] = rhs.Temperatures[i]; return *this; } bool FilterTSample::operator < (const FilterTSample& rhs ) { if ( time < rhs.time ) return true; else return false; } bool FilterTSample::operator > (const FilterTSample& rhs ) { if ( time > rhs.time ) return true; else return false; } double FilterTSample::getTemperature(int holder) { if (0 <= holder && holder < Num_of_SCMF) { return Temperatures[holder]; } else throw runtime_error("FilterTSample::getTemperature(): invalid filter index"); } void FilterTSample::setTemperature(int holder_no, double value) { if (0 <= holder_no && holder_no < Num_of_SCMF) Temperatures[holder_no] = value; else throw runtime_error("FilterTSample::setTemperature(): invalid filter index"); } void FilterTSample::dump() { std::cout << "time: " << time << ", Filter Holder T's: "; for(int i = 0; i < Num_of_SCMF; i++) std::cout << Temperatures[i] << " "; std::cout << std::endl; }