/** @class DetectorSample.cpp @author Brian Magill @datecreated 12/23/2005 $Date: 2006/04/07 14:14:54 $ $Revision: 1.3 $ @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 storew the data for all of the detectors for a given instant in time. Methods for the DetectorSample Class. This class contains the data for all channels for a particular time. */ //---------------------------------------------------------------------- // #include #include #include "DetectorSample.h" //#include "SOFIE_Exception.h" using namespace SOFIE; using namespace std; DetectorSample::DetectorSample(const DetectorSample& rhs ) { time = rhs.time; for(long i = 0; i < size(); i++) channel[i] = rhs.channel[i]; } DetectorSample& DetectorSample::operator = (const DetectorSample& rhs ) { if (this == &rhs) return *this; time = rhs.time; for(long i = 0; i < size(); i++) channel[i] = rhs.channel[i]; return *this; } bool DetectorSample::operator < (const DetectorSample& rhs ) { if ( time < rhs.time ) return true; else return false; } bool DetectorSample::operator > (const DetectorSample& rhs ) { if ( time > rhs.time ) return true; else return false; } double DetectorSample::getChan(long detector_num) { if(detector_num < 0 || detector_num > size() - 1) throw runtime_error("DetectorSample::getChan(): invalid detector number"); return channel[detector_num]; } void DetectorSample::setChan(long detector_num, double value) { if(detector_num < 0 || detector_num > size() - 1) throw runtime_error("DetectorSample::getChan(): invalid detector number"); channel[detector_num] = value; } void DetectorSample::dump() { std::cout << "time: " << time << std::endl; for(long i = 0; i < size(); i++) { cout << i << ", " << channel[i] << endl; } cout << endl; }