~vibhavp/ubuntu/saucy/urg/merge-from-debian

« back to all changes in this revision

Viewing changes to include/cpp/ConnectionUtils.h

  • Committer: Bazaar Package Importer
  • Author(s): Albert Huang
  • Date: 2010-03-30 01:43:55 UTC
  • Revision ID: james.westby@ubuntu.com-20100330014355-hz6mntlogs1uep7u
Tags: upstream-0.8.11
Import upstream version 0.8.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef QRK_CONNECTION_UTILS_H
 
2
#define QRK_CONNECTION_UTILS_H
 
3
 
 
4
/*!
 
5
  \file
 
6
  \brief Connection ��p�����⏕�֐�
 
7
 
 
8
  \author Satofumi KAMIMURA
 
9
 
 
10
  $Id: ConnectionUtils.h 1408 2009-10-14 20:55:13Z satofumi $
 
11
*/
 
12
 
 
13
#include <cstddef>
 
14
#include <algorithm>
 
15
 
 
16
 
 
17
/*!
 
18
  \brief Quick Robot Develoment Kit.
 
19
*/
 
20
namespace qrk
 
21
{
 
22
  class Connection;
 
23
 
 
24
 
 
25
  /*!
 
26
    \brief ���s�R�[�h����Ԃ�
 
27
 
 
28
    \retval true LF, CR �̂Ƃ�
 
29
    \retval false ��L�ȊO�̂Ƃ�
 
30
  */
 
31
  extern bool isLF(const char ch);
 
32
 
 
33
 
 
34
  /*!
 
35
    \brief ��M�f�[�^��ǂݔ�΂�
 
36
 
 
37
    Connection::clear() �Ƃ́A�^�C���A�E�g���Ԃ��w�肵�ēǂݔ�΂���_���قȂ�
 
38
 
 
39
    \param[in,out] con �ʐM���\�[�X
 
40
    \param[in] total_timeout �^�C���A�E�g���Ԃ̏�� [msec]
 
41
    \param[in] each_timeout ��M�f�[�^�Ԃɂ�����^�C���A�E�g���Ԃ̏�� [msec]
 
42
  */
 
43
  extern void skip(Connection* con, int total_timeout, int each_timeout = 0);
 
44
 
 
45
 
 
46
  /*!
 
47
    \brief ���s�܂ł̃f�[�^�ǂݏo��
 
48
 
 
49
    ������I�[�� \\0 ��t�����ĕԂ�
 
50
 
 
51
    \param[in,out] con �ʐM���\�[�X
 
52
    \param[out] buf ��M�o�b�t�@
 
53
    \param[in] count ��M�o�b�t�@�̍ő�T�C�Y
 
54
    \param[in] timeout �^�C���A�E�g [msec]
 
55
 
 
56
    \return ��M������ (��M���Ȃ��ă^�C���A�E�g�����ꍇ�� -1)
 
57
  */
 
58
  extern int readline(Connection* con, char* buf, const size_t count,
 
59
                      const int timeout);
 
60
 
 
61
 
 
62
  /*!
 
63
    \brief �ڑ��I�u�W�F�N�g�̌���
 
64
 
 
65
    a �� b �̐ڑ��I�u�W�F�N�g����������B
 
66
  */
 
67
  template <class T>
 
68
  void swapConnection(T& a, T& b)
 
69
  {
 
70
    Connection* t = a.connection();
 
71
    a.setConnection(b.connection());
 
72
    b.setConnection(t);
 
73
  }
 
74
}
 
75
 
 
76
#endif /* !QRK_CONNECTION_UTILS_H */