56 CTemporaryCommunicator(
void) : m_property(_T(
"TemporaryCommunicator"), TNBVIW_KIND_TEMP), m_isOpened(false), m_isSendError(false)
77 m_property.receivePacketSize = receivePacketSize;
78 m_property.sendPacketSize = sendPacketSize;
90 m_property.receiveTimeout = to;
130 virtual size_t Send(
size_t size, LPCVOID P)
132 if ( ! m_isOpened || m_isSendError )
139 m_sentRowData.Add(vb);
150 virtual size_t Receive(
size_t size, LPVOID _P)
155 INDEX idx = m_Find();
156 if ( idx != INVALID_INDEX )
158 TParam& p = m_receiveReserves[idx];
159 BYTE* B =
static_cast<BYTE*
>(_P);
160 size_t l = min(p.data.GetSize(), size);
161 MemCopy(B, p.data.ReferBuffer(), l);
162 if ( l >= p.data.GetSize() )
164 m_receiveReserves.
Remove(idx);
168 p.data.RemoveElements(0, l);
185 INDEX idx = m_Find();
186 if ( idx != INVALID_INDEX )
188 return m_receiveReserves[idx].data.
GetSize();
210 EXCLUSIVE2( &m_receiveReserves, &m_sentData );
213 m_sentRowData.RemoveAll();
229 p.tick = ::GetTickCount();
231 p.data.SetElements(size,
static_cast<const BYTE*
>(pData));
232 m_receiveReserves.
Add(p);
248 p.tick = ::GetTickCount();
251 m_receiveReserves.
Add(p);
274 return m_sentRowData;
284 m_isSendError = isSendError;
289 INDEX m_Find(
void)
const
291 loop ( i, m_receiveReserves )
293 const TParam& p = m_receiveReserves[i];
294 DWORD t = ::GetTickCount() - p.tick;
295 if ( p.delay == 0 || p.delay <= t )
300 return INVALID_INDEX;
314 _super::TProperty m_property;
#define loop(VAR, CNT)
loop構文.
virtual EState Check(void) const
[確認] チェック.
virtual bool SetReceiveTimeout(DWORD to)
[設定] 受信待ち時間設定.
virtual bool Open(void)
[処理] オープン.
void AddReceivingData(size_t size, LPCVOID pData, DWORD delay=0)
[処理] 受信情報に追加.
void AddReceivingData(const IConstCollectionT< BYTE > &data, DWORD delay=0)
[処理] 受信情報に追加.
CVectorT< CByteVector > & ReferSentRowData(void)
[取得] 送信情報参照.
virtual void Purge(void)
[処理] パージ.
virtual void Close(void)
[処理] クローズ.
virtual bool IsOpened(void) const
[確認] オープン確認.
virtual size_t Receive(size_t size, LPVOID _P)
[処理] 受信.
void SetSendErrorMode(bool isSendError)
[設定] 送信エラーモード設定.
virtual const TProperty & GetProperty(void) const
[取得] 性能取得
void SetPacketSize(DWORD receivePacketSize, DWORD sendPacketSize)
[設定] パケットサイズ設定.
virtual size_t GetReceivingDataSize(void) const
[確認] 受信データ確認.
CTemporaryCommunicator(void)
コンストラクタ
virtual size_t Send(size_t size, LPCVOID P)
[処理] 送信.
CByteVector & ReferSentData(void)
[取得] 送信情報参照.
virtual size_t GetSize(void) const
[取得] サイズ取得
virtual bool Remove(INDEX index)
[削除] 要素一つ削除.
virtual bool RemoveAll(void)
[削除] 空化
virtual INDEX Add(const TYP &t)
[追加] 要素一つ追加.
virtual size_t Append(const IConstCollectionT< TYP > &c)
[追加] 追加.
virtual size_t SetElements(size_t size, const TYP *P=NULL)
[設定] 複数要素設定.
#define EXCLUSIVE2(CLS1, CLS2)
簡易排他ツイン制御マクロ.
#define EXCLUSIVE(CLS)
簡易排他制御マクロ.
void MemCopy(T *_pDst, const void *pSrc, size_t len)
[複製] メモリコピー
virtual size_t GetSize(void) const =0
[取得] 要素数取得.