//where I am #include "R4_HEADER_State.h" //manager #include "StateManager.h" //home #include "R0_Init_State.h" //a step after #include "PacketSemanticAnalyzer.h" namespace PamOffLineSW { R4_HEADER_State R4_HEADER_State::instance; //extern LogUtil* mainLogUtil; //extern long int iNumCadres; //cadre's number //extern unsigned long long int iByte_tot;// how many bytes I have read till now extern bool isCadreGood;//if the cadre is good R4_HEADER_State::R4_HEADER_State() { headerPKT =NULL; pamPKT =NULL; pamPKT_length=0; posPamPKT=0; isPKTGood=true; } R4_HEADER_State::~R4_HEADER_State() { deleteBufferPKT(); pamPKT_length=0; posPamPKT=0; isPKTGood=true; } void R4_HEADER_State::deleteBufferPKT() { if(headerPKT) { delete[] headerPKT; headerPKT =NULL; } if(pamPKT) { delete[] pamPKT; pamPKT =NULL; } } void R4_HEADER_State::initBufferPKT(char* headPKT) { //I have found a Pamela Packet Header //I read how many bytes is the packet long long int pack_length = (long int)(unsigned char)(headPKT[14])+ 256*(long int)(unsigned char)(headPKT[13])+ 256*256*(long int)(unsigned char)(headPKT[12]); pamPKT_length=pack_length; deleteBufferPKT();//just to be sure // I will save the Pamela Packet and its header in this buffer headerPKT=new char[LENGTH_HEADER_PKT]; //I start copying on the buffer the Header for(int i=0;i