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

📄 vbaseobject.h

📁 otl简单包装实现类,对数据库进行操作的,简单易用.
💻 H
字号:
/***************************************************************************                          vbaseobject.h  -  description                             -------------------    begin                : ?  3? 4 2003    copyright            : (C) 2003 by |??|    email                : |zl@foundermn.com| ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef VBASEOBJECT_H#define VBASEOBJECT_H/**  *@author root  */#include <semaphore.h>#include <sys/select.h>#include <sys/time.h>#include <sys/timeb.h>#include <pthread.h>#include <error.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ipc.h>#include <sys/shm.h>#include <sys/msg.h>#include <unistd.h>#include <fcntl.h>#include <memory.h>#include <stdlib.h>#include <list>#include <algorithm>class VCritiSec{private:	pthread_mutex_t  m_Mutex;public:	VCritiSec();	~VCritiSec();	void Lock();	void Unlock();};class VAutoLock{private:	VCritiSec* m_CriLock;public:	VAutoLock(VCritiSec* pCriLock)	{	  	m_CriLock = pCriLock;		if(m_CriLock) m_CriLock->Lock();  	}	~VAutoLock()	{	  	if(m_CriLock) m_CriLock->Unlock();	}	};class VEvent{private:    pthread_mutex_t m_ELock;    pthread_cond_t  m_ECond;public: 	VEvent();	~VEvent();    	long Wait(long msec=0);	void Set();};class VShmObject{private:    key_t   m_Key;    size_t  m_Size;    int     m_Id;    void*   m_pShm;public:    VShmObject();    ~VShmObject();    void* Create(size_t Size,key_t Key=0);    void  Destroy();    key_t GetKey();    size_t GetSize();    void* GetShm(int Offset=0);};class VMsgObject{private:	key_t   m_Key;	int     m_Id;public:	VMsgObject();	~VMsgObject();	int Create(key_t Key=0);	int Send(void* msgPtr,size_t msgSize);	int Recv(long int msgType,void* msgPtr,size_t msgSize);	void Destroy();};class VFileLock{private:	char   m_LockFile[256];	int    m_LockFd;private:	int  Lock_Reg(int Cmd,int Type,off_t Offset,off_t Len);public:	VFileLock();	~VFileLock();	int  Open(const char* LockFile);	int  Open(VFileLock& FLock);	void  Close();	int   ReadLock(off_t Offset,off_t Len);	int   WriteLock(off_t Offset,off_t Len);	int   ReadBlock(off_t Offset,off_t Len);	int   WriteBlock(off_t Offset,off_t Len);	int   Unlock(off_t Offset,off_t Len);	int   Read(char* Buf,off_t Offset,off_t Len);	int   Write(const char* Buf,off_t Offset,off_t Len);};typedef void* (*VVTHREAD)(void*);class VVThread{private:	VVTHREAD  ProxyThreadFunc;	void*     m_pArg;	pthread_t m_Pid;public:	VVThread();	VVThread(VVTHREAD ThreadFunc,void* Arg);	~VVThread();	void SetThread(VVTHREAD ThreadFunc,void* Arg);	bool Start();	void Detach();	void Join();	};class VVThreadGroup{public:	VVThreadGroup();	~VVThreadGroup();	VVThread* Create(VVTHREAD ThreadFunc,void* Arg);	void Add(VVThread* pThread);	void Remove(VVThread* pThread);	void Join();  	void Delete();private:	std::list<VVThread*>  m_Group;	VCritiSec  m_CriGroup;};		#endif

⌨️ 快捷键说明

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