// $Id: PlexPixelSpotToStripEnd.h,v 1.8 2005/08/26 18:47:03 rhatcher Exp $

#ifndef PLEXPIXELSPOTTOSTRIPEND_H
#define PLEXPIXELSPOTTOSTRIPEND_H

////////////////////////////////////////////////////////////////////////
// PlexPixelSpotToStripEnd
//
// Package: Plex
//
// Concept:
//
//
// R. hatcher 2001-06-27
////////////////////////////////////////////////////////////////////////

#include "DatabaseInterface/DbiTableRow.h"
#include "LeakChecker/Lea.h"

#include "Plex/PlexPixelSpotId.h"
#include "Plex/PlexStripEndId.h"

class DbiValidityRec;

class PlexPixelSpotToStripEnd : public DbiTableRow
{

public:

// Constructors and destructors.

   PlexPixelSpotToStripEnd() { LEA_CTOR; }
   PlexPixelSpotToStripEnd(Detector::Detector_t det,
                           ElecType::Elec_t elec, 
                           Char_t eastwest, Char_t racklevel, 
                           Int_t rackbay, Int_t inrack,
                           Int_t tube, Int_t pixel, Int_t spot,
                           Int_t plane, Int_t strip, 
                           StripEnd::StripEnd_t end) :
      fPlexPixelSpotId(det,elec,eastwest,racklevel,rackbay,inrack,tube,pixel,spot),
      fPlexStripEndId(det,plane,strip,end) { LEA_CTOR; };
   virtual ~PlexPixelSpotToStripEnd(){ LEA_DTOR; };

// State testing member functions

   virtual Int_t    GetAggregateNo() const { return fAggregate; }
   PlexPixelSpotId  GetPlexPixelSpotId() const { return fPlexPixelSpotId; }
   PlexStripEndId   GetPlexStripEndId()  const { return fPlexStripEndId; }

   virtual DbiTableRow* CreateTableRow() const { return new PlexPixelSpotToStripEnd; }

// I/O  member functions

   virtual void Fill(DbiResultSet& rs,
                     const DbiValidityRec* vrec);
   virtual void Store(DbiOutRowStream& ors,
                      const DbiValidityRec* vrec) const;

   static void   SetDefensiveUnpkg(Bool_t defensive) 
      { fgDefensiveUnpkg = defensive; }
   static Bool_t GetDefensiveUnpkg() { return fgDefensiveUnpkg; }

private:  

// Constructors and destructors.

   PlexPixelSpotToStripEnd(const PlexPixelSpotToStripEnd& from) 
     : DbiTableRow(from) { LEA_CTOR; *this = from; }

// Data members

   Int_t            fAggregate;
   PlexPixelSpotId  fPlexPixelSpotId;
   PlexStripEndId   fPlexStripEndId;

// class-wide static

   static Bool_t fgDefensiveUnpkg;

ClassDef(PlexPixelSpotToStripEnd,0)

};

#endif  // PLEXPIXELSPOTTOSTRIPEND_H
