RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_SendTextMessageStreamProxy.h
浏览该文件的文档.
1
25// Copyright Iowa State University 2011.
26// Distributed under the Boost Software License, Version 1.0.
27// (See accompanying file LICENSE_1_0.txt or copy at
28// http://www.boost.org/LICENSE_1_0.txt)
29
30#pragma once
31
32// Internal Includes
33#include "vrpn_BaseClass.h"
34
35// Library/third-party includes
36// - none
37
38// Standard includes
39#include <sstream>
40
42private:
46
48 std::ostringstream _s;
49
52 operator=(vrpn_SendTextMessageStreamProxy const&);
53
54public:
56 template <typename T>
59 T const& firstData)
60 : _call(call)
61 {
62 _s << firstData;
63 }
64
69 std::string const& firstData)
70 : _call(call)
71 , _s(firstData)
72 {
73 }
74
78 : _call(other._call)
79 , _s(other._s.str())
80 {
81 }
82
85 ~vrpn_SendTextMessageStreamProxy() { _call(_s.str().c_str()); }
86
93 template <typename T> std::ostream& operator<<(T const& other)
94 {
95 _s << other;
96 return _s;
97 }
98};
99
108template <typename T>
111 T const& firstData)
112{
113 return vrpn_SendTextMessageStreamProxy(call, firstData);
114}
定义 vrpn_SendTextMessageStreamProxy.h:41
vrpn_SendTextMessageStreamProxy(vrpn_BaseClassUnique::SendTextMessageBoundCall const &call, T const &firstData)
Templated constructor taking anything streamable.
定义 vrpn_SendTextMessageStreamProxy.h:57
~vrpn_SendTextMessageStreamProxy()
定义 vrpn_SendTextMessageStreamProxy.h:85
vrpn_SendTextMessageStreamProxy(vrpn_BaseClassUnique::SendTextMessageBoundCall const &call, std::string const &firstData)
定义 vrpn_SendTextMessageStreamProxy.h:67
std::ostream & operator<<(T const &other)
定义 vrpn_SendTextMessageStreamProxy.h:93
vrpn_SendTextMessageStreamProxy(vrpn_SendTextMessageStreamProxy const &other)
Copy constructor - required for return by value (?)
定义 vrpn_SendTextMessageStreamProxy.h:76
vrpn_SendTextMessageStreamProxy operator<<(vrpn_BaseClassUnique::SendTextMessageBoundCall const &call, T const &firstData)
定义 vrpn_SendTextMessageStreamProxy.h:110