⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sesstack.h

📁 在LINUX环境下
💻 H
字号:
/****************************************************************************
 *
 *         (c) Copyright 2006 by SCADA Enterprise Solutions Inc
 *         All rights reserved
 *
 * NAME:
 *
 *         sesStack.H -- This is the header file for declaring all data
 *                       of a customized stack whose contents is stored
 *                       in the shared memory.
 *
 * AUTHOR: Wai Tse
 *
 * DESCRIPTION:
 *
 *         This file contains all data structures used by a stack.
 *
 * RESTRICTION:
 *         None
 *
 * REVISION HISTORY:
 *
 *         28-JUN-2006    Wai Tse    Created the initial version.
 *
 ***************************************************************************/
#ifndef STACK_H
#define STACK_H

#include <sys/shm.h>
#include "sesConst.H"
#include "sesDbg.H"
#include "sesLogErr.H"

class sesStack
{
public:
              sesStack(){ };
              sesStack(int numElem, int elemSize, char *memKey, char *semKey);
              sesStack(char *memKey);
             ~sesStack();
  int         put(const void *entry, int numEntry);
  int         get(void *entry, int numEntry);


private:
  typedef struct {
     int   numElem;      // total number of elements in a stack
     int   elemSize;     // size of each element
     char  semKey[64];   // key name for semaphore
     int   start;        // start index of the stack
     int   end;          // end index of the stack (not used yet)
  } stackHeader;


     int             _numElem;   // number of elements in a stack
     int             _elemSize;  // size of each element in a stack
     int             _emptySpot; // empty spots in the stack
     int             _shmid;     // shared memory ID
     int             _semid;     // semaphore ID
     int             _startIdx;  // start index, spot already filled
     int             _endIdx;    // end index, spot not used yet
     stackHeader    *_stackHdr;  // stack header pointer
     void           *_stack;     // stack pointer
};

#endif // STACK_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -