vrpn
07.35
Virtual Reality Peripheral Network
Toggle main menu visibility
Loading...
Searching...
No Matches
vrpn_SendTextMessageStreamProxy.h
Go to the documentation of this file.
1
24
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
41
class
vrpn_SendTextMessageStreamProxy
{
42
private
:
45
vrpn_BaseClassUnique::SendTextMessageBoundCall
const
& _call;
46
48
std::ostringstream _s;
49
51
vrpn_SendTextMessageStreamProxy
&
52
operator=(
vrpn_SendTextMessageStreamProxy
const
&);
53
54
public
:
56
template
<
typename
T>
57
vrpn_SendTextMessageStreamProxy
(
58
vrpn_BaseClassUnique::SendTextMessageBoundCall
const
& call,
59
T
const
& firstData)
60
: _call(call)
61
{
62
_s << firstData;
63
}
64
67
vrpn_SendTextMessageStreamProxy
(
68
vrpn_BaseClassUnique::SendTextMessageBoundCall
const
& call,
69
std::string
const
& firstData)
70
: _call(call)
71
, _s(firstData)
72
{
73
}
74
76
vrpn_SendTextMessageStreamProxy
(
77
vrpn_SendTextMessageStreamProxy
const
& other)
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
108
template
<
typename
T>
109
vrpn_SendTextMessageStreamProxy
110
operator<<
(
vrpn_BaseClassUnique::SendTextMessageBoundCall
const
& call,
111
T
const
& firstData)
112
{
113
return
vrpn_SendTextMessageStreamProxy
(call, firstData);
114
}
vrpn_BaseClassUnique::SendTextMessageBoundCall
Definition
vrpn_BaseClass.h:199
vrpn_SendTextMessageStreamProxy
Definition
vrpn_SendTextMessageStreamProxy.h:41
vrpn_SendTextMessageStreamProxy::~vrpn_SendTextMessageStreamProxy
~vrpn_SendTextMessageStreamProxy()
Destructor performs the send_text_message call with all contents streamed into it.
Definition
vrpn_SendTextMessageStreamProxy.h:85
vrpn_SendTextMessageStreamProxy::vrpn_SendTextMessageStreamProxy
vrpn_SendTextMessageStreamProxy(vrpn_BaseClassUnique::SendTextMessageBoundCall const &call, std::string const &firstData)
Constructor taking a std::string, since we can use the ostringstream's std::string constructor in thi...
Definition
vrpn_SendTextMessageStreamProxy.h:67
vrpn_SendTextMessageStreamProxy::operator<<
std::ostream & operator<<(T const &other)
Template operator<<, used for the second item streamed into the results of a BoundCall-returning send...
Definition
vrpn_SendTextMessageStreamProxy.h:93
vrpn_SendTextMessageStreamProxy::vrpn_SendTextMessageStreamProxy
vrpn_SendTextMessageStreamProxy(vrpn_BaseClassUnique::SendTextMessageBoundCall const &call, T const &firstData)
Templated constructor taking anything streamable.
Definition
vrpn_SendTextMessageStreamProxy.h:57
vrpn_SendTextMessageStreamProxy::vrpn_SendTextMessageStreamProxy
vrpn_SendTextMessageStreamProxy(vrpn_SendTextMessageStreamProxy const &other)
Copy constructor - required for return by value (?).
Definition
vrpn_SendTextMessageStreamProxy.h:76
vrpn_BaseClass.h
All types of client/server/peer objects in VRPN should be derived from the vrpn_BaseClass type descri...
operator<<
vrpn_SendTextMessageStreamProxy operator<<(vrpn_BaseClassUnique::SendTextMessageBoundCall const &call, T const &firstData)
Templated operator << that takes a vrpn_BaseClassUnique::SendTextMessageBoundCall on the left,...
Definition
vrpn_SendTextMessageStreamProxy.h:110
vrpn_SendTextMessageStreamProxy.h
Generated by
1.17.0