Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cOSPipe.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cOSPipe_H
7 #define _INC_cOSPipe_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
14 
15 #ifndef UNDER_CE
16 #include "GrayCore/include/cFilePath.h" // cStringF
18 
19 namespace GrayLib
20 {
22 
24  {
31 
32  protected:
33  cOSPipe(void);
34  virtual ~cOSPipe(void);
35 
36  public:
37  static StrLen_t GRAYCALL MakePipePath(OUT FILECHAR_t* pszPipePath, StrLen_t nLenMax, const FILECHAR_t* pszPipeName);
39  };
40 
42  {
46  public:
47  static const size_t kSizeDef = 1024;
48 
49 #ifdef _WIN32
50  private:
51  bool m_bConnected; // i currently have a client connected.
52  protected:
53  HRESULT ConnectPipe();
54 #endif
55  public:
56  bool isConnected() const noexcept
57  {
58  return m_bConnected; // i currently have a client connected.
59  }
60  cOSPipeServer(void);
61  virtual ~cOSPipeServer(void);
62  HRESULT CreatePipe(const FILECHAR_t* pszPipeName, size_t nOutBufferSize = kSizeDef, TIMESYS_t waitForClient = cTimeSys::k_FREQ / 2);
63  virtual HRESULT ReadX(void* pBuffer, size_t nDataSize) override;
64  };
65 
67  {
70 
71  public:
72  cOSPipeClient();
73  virtual ~cOSPipeClient(void);
74 
75  HRESULT OpenPipe(const FILECHAR_t* pszPipeName, TIMESYSD_t nTimeOutTotal = 0);
76  virtual HRESULT WriteX(const void* pBuffer, size_t nDataSize) override;
77 
78  static HRESULT GRAYCALL OpenWritePipe(const FILECHAR_t* pszPipeName, TIMESYSD_t nTimeOutTotal, const void* pBuffer, size_t nDataSize);
79  };
80 };
81 #endif // UNDER_CE
82 #endif
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cOSPipe.h:67
Definition: cOSPipe.h:42
bool isConnected() const noexcept
Definition: cOSPipe.h:56
Definition: cOSPipe.h:24
UNITTEST2_PREDEF(cOSPipe)
Definition: cOSHandle.h:59
Definition: cStream.h:306
Definition: cStream.h:126
static const TIMESYS_t k_FREQ
milliSec per Sec
Definition: cTimeSys.h:100
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
INT32 TIMESYSD_t
Time delta. signed milli-Seconds Span. cTimeSys::k_DMAX, cTimeSys::k_INF = MAILSLOT_WAIT_FOREVER.
Definition: cTimeSys.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
UINT32 TIMESYS_t
TIMESYS_t = The normal system tick timer. milli-seconds since start of system/app ?
Definition: cTimeSys.h:27