Homepage Demos Overview Downloads Tutorials Reference
Credits

ButtonEvent.cc

Go to the documentation of this file.
00001 #include "ButtonEvent.h"
00002 #include <sstream>
00003 
00004 std::string
00005 ButtonEvent::getDescription(bool /*showTypeSpecific=true*/, unsigned int verbosity/*=0*/) const {
00006   std::ostringstream logdata;
00007   logdata << getName();
00008   char hexstring[30];
00009   snprintf(hexstring,sizeof(hexstring),"0x%x",getSourceID());
00010   logdata << '\t' << hexstring;
00011   switch(getTypeID()) {
00012   case EventBase::activateETID:
00013     logdata << "\tA"; break;
00014   case EventBase::statusETID:
00015     logdata << "\tS"; break;
00016   case EventBase::deactivateETID:
00017     logdata << "\tD"; break;
00018   case EventBase::numETIDs:
00019     logdata << "\tU"; break;  //UNKNOWN TYPE
00020   }
00021   if(verbosity>=1)
00022     logdata << '\t' << getDuration() << '\t' << getTimeStamp();
00023   if(verbosity>=2)
00024     logdata << '\t' << getMagnitude();
00025   return logdata.str();
00026 }
00027 
00028 unsigned int
00029 ButtonEvent::getBinSize() const {
00030   unsigned int used=0;
00031   used+=creatorSize("ButtonEvent");
00032   used+=EventBase::getBinSize();
00033   return used;
00034 }
00035 
00036 unsigned int
00037 ButtonEvent::LoadBuffer(const char buf[], unsigned int len) {
00038   unsigned int origlen=len;
00039   unsigned int used=0;
00040   if(0==(used=checkCreator("ButtonEvent",buf,len,true))) return 0;
00041   len-=used; buf+=used;
00042   if(0==(used=EventBase::LoadBuffer(buf,len))) return 0;
00043   len-=used; buf+=used;
00044   return origlen-len; 
00045 }
00046 
00047 unsigned int
00048 ButtonEvent::SaveBuffer(char buf[], unsigned int len) const {
00049   unsigned int origlen=len;
00050   unsigned int used=0;
00051   if(0==(used=saveCreator("ButtonEvent",buf,len))) return 0;
00052   len-=used; buf+=used;
00053   if(0==(used=EventBase::SaveBuffer(buf,len))) return 0;
00054   len-=used; buf+=used;
00055   return origlen-len;
00056 }
00057 
00058 void
00059 ButtonEvent::genName() {
00060   if(!nameisgen)
00061     return;
00062   if(genID<numEGIDs) {
00063     stim_id=std::string("Evt_");
00064     stim_id+=EventGeneratorNames[genID];
00065   } else {
00066     stim_id=std::string("Evt_InvalidGen");
00067     stim_id+=genID; 
00068   }
00069   stim_id+="::";
00070   char tmp[16];
00071   snprintf(tmp,16,"0x%x",sourceID);
00072   stim_id+=tmp;
00073 }
00074 
00075 
00076 /*! @file
00077  * @brief 
00078  * @author YOURNAMEHERE (Creator)
00079  *
00080  * $Author: ejt $
00081  * $Name: tekkotsu-2_2 $
00082  * $Revision: 1.1 $
00083  * $State: Exp $
00084  * $Date: 2004/09/16 20:39:53 $
00085  */
00086 

Tekkotsu v2.2
Generated Tue Oct 19 14:19:13 2004 by Doxygen 1.3.9.1