1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/event/PscuHeader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/event/PscuHeader.cpp,v $ |
3 |
* $Id: PscuHeader.cpp,v 2.0 2004/09/21 20:49:57 kusanagi Exp $ |
* $Id: PscuHeader.cpp,v 2.1 2004/09/24 11:57:32 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the PscuHeader class. |
* Implementation of the PscuHeader class. |
7 |
*/ |
*/ |
|
#include <exception> |
|
|
#include <string> |
|
|
#include <sstream> |
|
|
|
|
8 |
#include <log4cxx/logger.h> |
#include <log4cxx/logger.h> |
|
|
|
9 |
#include "PscuHeader.h" |
#include "PscuHeader.h" |
|
#include "Exception.h" |
|
10 |
|
|
11 |
using namespace pamela; |
using namespace pamela; |
12 |
|
|
13 |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.PscuHeader")); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.PscuHeader")); |
14 |
static std::stringstream oss; |
//static std::stringstream oss; |
15 |
|
|
16 |
/** |
/** |
17 |
* Create an PscuHeader object. |
* Create an PscuHeader object. |
28 |
/** |
/** |
29 |
* Get the packet type of this header. |
* Get the packet type of this header. |
30 |
*/ |
*/ |
31 |
const PacketType* PscuHeader::GetPacketType(void) const throw (std::exception) { |
const PacketType* PscuHeader::GetPacketType(void) const throw (UnidentifiedPacketException) { |
32 |
switch (PacketId1) { |
switch (PacketId1) { |
33 |
case 0x07: return PacketType::PhysEndRun; |
case 0x07: return PacketType::PhysEndRun; |
34 |
case 0x08: return PacketType::CalibCalPulse1; |
case 0x08: return PacketType::CalibCalPulse1; |
71 |
case 0x85: return PacketType::TofAlarm; |
case 0x85: return PacketType::TofAlarm; |
72 |
|
|
73 |
default: { |
default: { |
74 |
oss.flush(); |
throw UnidentifiedPacketException(PacketId1); |
|
oss << "\n Unrecognized PacketType: " |
|
|
<< (int)PacketId1; |
|
|
logger->error(oss.str().c_str()); |
|
|
throw Exception("Invalid Packed Id1"); |
|
75 |
} |
} |
76 |
} |
} |
77 |
} |
} |