Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
SerialBuffer.h
Package: cktx.rar [view]
Upload User: chineseart
Upload Date: 2022-06-24
Package Size: 52k
Code Size: 2k
Category:
Com Port
Development Platform:
Visual C++
- // SerialBuffer.h: interface for the CSerialBuffer class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_SerialBuffer_H__FD164A5F_9F09_451B_8E42_180999B4DB9A__INCLUDED_)
- #define AFX_SerialBuffer_H__FD164A5F_9F09_451B_8E42_180999B4DB9A__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include <string>
- class CSerialBuffer
- {
- std::string m_szInternalBuffer;
- CRITICAL_SECTION m_csLock;
- bool m_abLockAlways;
- long m_iCurPos;
- long m_alBytesUnRead;
- void Init();
- void ClearAndReset(HANDLE& hEventToReset);
- public:
- inline void LockBuffer() {::EnterCriticalSection(&m_csLock );}
- inline void UnLockBuffer() {::LeaveCriticalSection(&m_csLock );}
- CSerialBuffer( );
- virtual ~CSerialBuffer();
- //---- public interface --
- void AddData( char ch ) ;
- void AddData( std::string& szData ) ;
- void AddData( std::string& szData,int iLen ) ;
- void AddData( char *strData,int iLen ) ;
- std::string GetData() {return m_szInternalBuffer;}
- void Flush();
- long Read_N( std::string &szData,long alCount,HANDLE& hEventToReset);
- bool Read_Upto( std::string &szData,char chTerm,long &alBytesRead ,HANDLE& hEventToReset);
- bool Read_Available( std::string &szData,HANDLE & hEventToReset);
- inline long GetSize() {return m_szInternalBuffer.size();}
- inline bool IsEmpty() {return m_szInternalBuffer.size() == 0; }
- bool Read_Upto_FIX( std::string &szData,char chTerm,long &alBytesRead,HANDLE & hEventToReset);
- };
- #endif // !defined(AFX_SerialBuffer_H__FD164A5F_9F09_451B_8E42_180999B4DB9A__INCLUDED_)