00001 #ifndef __SMCOMMON_H__
00002 #define __SMCOMMON_H__
00003
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <unistd.h>
00007 #include <sys/types.h>
00008 #include <sys/ipc.h>
00009 #include <sys/shm.h>
00010 #include <sys/msg.h>
00011
00012
00013 #include "../header.hh"
00014
00015
00016 #define KEYFILE_PATH "/daq/DAQ/lifetime/CounterTest/CounterDAQ"
00017 #define PROJ_CHAR (char)'r'
00018 #define FIN (int)6
00019 #define PAUSE (int)16
00020 #define RESTART (int)18
00021
00022 struct SHM_PARAM{
00023 int shd_param_id;
00024 int status;
00025 int ctrl;
00026 char StartTime[150];
00027
00028
00029 int nEvent;
00030 int nOverFlow;
00031 int Hist[250];
00032 };
00033
00034 class SharedMemory{
00035 private:
00036
00037
00038
00039
00040 public:
00041 SharedMemory();
00042 int shm_initialize(key_t shm_key, int shm_size,int *shrd_id,int *shm_ptr);
00043 int shm_access(key_t shm_key, int shm_size, int *shrd_id, int *shm_ptr);
00044 int erase_shm(struct SHM_PARAM *param_ptr);
00045
00046 };
00047
00048 #endif