Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / serial_port_base.hpp @ 2486

History | View | Annotate | Download (4.9 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// serial_port_base.hpp
3 2486 sjacqu01
// ~~~~~~~~~~~~~~~~~~~~
4 2486 sjacqu01
//
5 2486 sjacqu01
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 2486 sjacqu01
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
7 2486 sjacqu01
//
8 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See accompanying
9 2486 sjacqu01
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 2486 sjacqu01
//
11 2486 sjacqu01
12 2486 sjacqu01
#ifndef BOOST_ASIO_SERIAL_PORT_BASE_HPP
13 2486 sjacqu01
#define BOOST_ASIO_SERIAL_PORT_BASE_HPP
14 2486 sjacqu01
15 2486 sjacqu01
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 2486 sjacqu01
# pragma once
17 2486 sjacqu01
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 2486 sjacqu01
19 2486 sjacqu01
#include <boost/asio/detail/config.hpp>
20 2486 sjacqu01
21 2486 sjacqu01
#if defined(BOOST_ASIO_HAS_SERIAL_PORT) \
22 2486 sjacqu01
  || defined(GENERATING_DOCUMENTATION)
23 2486 sjacqu01
24 2486 sjacqu01
#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
25 2486 sjacqu01
# include <termios.h>
26 2486 sjacqu01
#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
27 2486 sjacqu01
28 2486 sjacqu01
#include <boost/asio/detail/socket_types.hpp>
29 2486 sjacqu01
#include <boost/system/error_code.hpp>
30 2486 sjacqu01
31 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
32 2486 sjacqu01
# define BOOST_ASIO_OPTION_STORAGE implementation_defined
33 2486 sjacqu01
#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
34 2486 sjacqu01
# define BOOST_ASIO_OPTION_STORAGE DCB
35 2486 sjacqu01
#else
36 2486 sjacqu01
# define BOOST_ASIO_OPTION_STORAGE termios
37 2486 sjacqu01
#endif
38 2486 sjacqu01
39 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
40 2486 sjacqu01
41 2486 sjacqu01
namespace boost {
42 2486 sjacqu01
namespace asio {
43 2486 sjacqu01
44 2486 sjacqu01
/// The serial_port_base class is used as a base for the basic_serial_port class
45 2486 sjacqu01
/// template so that we have a common place to define the serial port options.
46 2486 sjacqu01
class serial_port_base
47 2486 sjacqu01
{
48 2486 sjacqu01
public:
49 2486 sjacqu01
  /// Serial port option to permit changing the baud rate.
50 2486 sjacqu01
  /**
51 2486 sjacqu01
   * Implements changing the baud rate for a given serial port.
52 2486 sjacqu01
   */
53 2486 sjacqu01
  class baud_rate
54 2486 sjacqu01
  {
55 2486 sjacqu01
  public:
56 2486 sjacqu01
    explicit baud_rate(unsigned int rate = 0);
57 2486 sjacqu01
    unsigned int value() const;
58 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code store(
59 2486 sjacqu01
        BOOST_ASIO_OPTION_STORAGE& storage,
60 2486 sjacqu01
        boost::system::error_code& ec) const;
61 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code load(
62 2486 sjacqu01
        const BOOST_ASIO_OPTION_STORAGE& storage,
63 2486 sjacqu01
        boost::system::error_code& ec);
64 2486 sjacqu01
  private:
65 2486 sjacqu01
    unsigned int value_;
66 2486 sjacqu01
  };
67 2486 sjacqu01
68 2486 sjacqu01
  /// Serial port option to permit changing the flow control.
69 2486 sjacqu01
  /**
70 2486 sjacqu01
   * Implements changing the flow control for a given serial port.
71 2486 sjacqu01
   */
72 2486 sjacqu01
  class flow_control
73 2486 sjacqu01
  {
74 2486 sjacqu01
  public:
75 2486 sjacqu01
    enum type { none, software, hardware };
76 2486 sjacqu01
    BOOST_ASIO_DECL explicit flow_control(type t = none);
77 2486 sjacqu01
    type value() const;
78 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code store(
79 2486 sjacqu01
        BOOST_ASIO_OPTION_STORAGE& storage,
80 2486 sjacqu01
        boost::system::error_code& ec) const;
81 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code load(
82 2486 sjacqu01
        const BOOST_ASIO_OPTION_STORAGE& storage,
83 2486 sjacqu01
        boost::system::error_code& ec);
84 2486 sjacqu01
  private:
85 2486 sjacqu01
    type value_;
86 2486 sjacqu01
  };
87 2486 sjacqu01
88 2486 sjacqu01
  /// Serial port option to permit changing the parity.
89 2486 sjacqu01
  /**
90 2486 sjacqu01
   * Implements changing the parity for a given serial port.
91 2486 sjacqu01
   */
92 2486 sjacqu01
  class parity
93 2486 sjacqu01
  {
94 2486 sjacqu01
  public:
95 2486 sjacqu01
    enum type { none, odd, even };
96 2486 sjacqu01
    BOOST_ASIO_DECL explicit parity(type t = none);
97 2486 sjacqu01
    type value() const;
98 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code store(
99 2486 sjacqu01
        BOOST_ASIO_OPTION_STORAGE& storage,
100 2486 sjacqu01
        boost::system::error_code& ec) const;
101 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code load(
102 2486 sjacqu01
        const BOOST_ASIO_OPTION_STORAGE& storage,
103 2486 sjacqu01
        boost::system::error_code& ec);
104 2486 sjacqu01
  private:
105 2486 sjacqu01
    type value_;
106 2486 sjacqu01
  };
107 2486 sjacqu01
108 2486 sjacqu01
  /// Serial port option to permit changing the number of stop bits.
109 2486 sjacqu01
  /**
110 2486 sjacqu01
   * Implements changing the number of stop bits for a given serial port.
111 2486 sjacqu01
   */
112 2486 sjacqu01
  class stop_bits
113 2486 sjacqu01
  {
114 2486 sjacqu01
  public:
115 2486 sjacqu01
    enum type { one, onepointfive, two };
116 2486 sjacqu01
    BOOST_ASIO_DECL explicit stop_bits(type t = one);
117 2486 sjacqu01
    type value() const;
118 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code store(
119 2486 sjacqu01
        BOOST_ASIO_OPTION_STORAGE& storage,
120 2486 sjacqu01
        boost::system::error_code& ec) const;
121 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code load(
122 2486 sjacqu01
        const BOOST_ASIO_OPTION_STORAGE& storage,
123 2486 sjacqu01
        boost::system::error_code& ec);
124 2486 sjacqu01
  private:
125 2486 sjacqu01
    type value_;
126 2486 sjacqu01
  };
127 2486 sjacqu01
128 2486 sjacqu01
  /// Serial port option to permit changing the character size.
129 2486 sjacqu01
  /**
130 2486 sjacqu01
   * Implements changing the character size for a given serial port.
131 2486 sjacqu01
   */
132 2486 sjacqu01
  class character_size
133 2486 sjacqu01
  {
134 2486 sjacqu01
  public:
135 2486 sjacqu01
    BOOST_ASIO_DECL explicit character_size(unsigned int t = 8);
136 2486 sjacqu01
    unsigned int value() const;
137 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code store(
138 2486 sjacqu01
        BOOST_ASIO_OPTION_STORAGE& storage,
139 2486 sjacqu01
        boost::system::error_code& ec) const;
140 2486 sjacqu01
    BOOST_ASIO_DECL boost::system::error_code load(
141 2486 sjacqu01
        const BOOST_ASIO_OPTION_STORAGE& storage,
142 2486 sjacqu01
        boost::system::error_code& ec);
143 2486 sjacqu01
  private:
144 2486 sjacqu01
    unsigned int value_;
145 2486 sjacqu01
  };
146 2486 sjacqu01
147 2486 sjacqu01
protected:
148 2486 sjacqu01
  /// Protected destructor to prevent deletion through this type.
149 2486 sjacqu01
  ~serial_port_base()
150 2486 sjacqu01
  {
151 2486 sjacqu01
  }
152 2486 sjacqu01
};
153 2486 sjacqu01
154 2486 sjacqu01
} // namespace asio
155 2486 sjacqu01
} // namespace boost
156 2486 sjacqu01
157 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
158 2486 sjacqu01
159 2486 sjacqu01
#undef BOOST_ASIO_OPTION_STORAGE
160 2486 sjacqu01
161 2486 sjacqu01
#include <boost/asio/impl/serial_port_base.hpp>
162 2486 sjacqu01
#if defined(BOOST_ASIO_HEADER_ONLY)
163 2486 sjacqu01
# include <boost/asio/impl/serial_port_base.ipp>
164 2486 sjacqu01
#endif // defined(BOOST_ASIO_HEADER_ONLY)
165 2486 sjacqu01
166 2486 sjacqu01
#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT)
167 2486 sjacqu01
       //   || defined(GENERATING_DOCUMENTATION)
168 2486 sjacqu01
169 2486 sjacqu01
#endif // BOOST_ASIO_SERIAL_PORT_BASE_HPP