// =====================================================================
//  $Id: TSoftwareScalerModule.cc,v 1.4 2004/03/07 10:30:31 goiwai Exp $
//  $Name: CLDAQ-1-14-03 $
//  $Log: TSoftwareScalerModule.cc,v $
//  Revision 1.4  2004/03/07 10:30:31  goiwai
//  ROOTに組みこむためのおまじないマクロを埋めこみました。
//  全てにおいて完全に動作するわけではありません。
//
//  Revision 1.3  2003/10/06 17:02:40  goiwai
//  *** empty log message ***
//
//  Revision 1.2  2003/07/30 16:19:11  goiwai
//  ファイルにコミットログをつけることにしました.
//
// =====================================================================
#include "TSoftwareScalerModule.hh"
#include "TDataSegment.hh"
#include "TDataElement.hh"

TSoftwareScalerModule::TSoftwareScalerModule( Tint nchannel )
  : TSoftwareModule( nchannel ), theChannel( nchannel, 0 )
{;}

TSoftwareScalerModule::TSoftwareScalerModule( const TSoftwareScalerModule& right )
  : TSoftwareModule( right ), theChannel( right.theChannel )
{;}

TSoftwareScalerModule::~TSoftwareScalerModule()
{;}

Tvoid TSoftwareScalerModule::FillData( TDataElement& element, Tint channel )
{
  if ( channel < 0 || channel >= theNumberOfChannels ) {
    Tcerr << "TSoftwareScalerModule::FillData: invalid ID " << channel << Tendl;
    theStatus = -EFAULT;
    element.FillData( &theStatus, tTypeInt, 1 );
  } else {
    element.FillData( &theChannel[ channel ], tTypeInt, 1 );
  }
  return;
}

const TSoftwareScalerModule& TSoftwareScalerModule::operator=( const TSoftwareScalerModule& right )
{
  *( (TSoftwareModule*)this ) = *( (TSoftwareModule*)(&right) );
  theChannel = right.theChannel;
  return *this;
}

Tbool TSoftwareScalerModule::operator==( const TSoftwareScalerModule& right ) const
{
  Tbool ret = Ttrue;
  ret &= ( *( (TSoftwareModule*)this ) == *( (TSoftwareModule*)(&right) ) );
  ret &= ( theChannel == right.theChannel );
  return ret;
}

Tbool TSoftwareScalerModule::operator!=( const TSoftwareScalerModule& right ) const
{
  Tbool ret = Tfalse;
  ret |= ( *( (TSoftwareModule*)this ) != *( (TSoftwareModule*)(&right) ) );
  ret |= ( theChannel != right.theChannel );
  return ret;
}

#ifdef __CLDAQ_ROOT_DLL
    ClassImp(TSoftwareScalerModule)
#endif
