37 #ifndef INCLUDED_OSCPACK_OSCOUTBOUNDPACKETSTREAM_H
38 #define INCLUDED_OSCPACK_OSCOUTBOUNDPACKETSTREAM_H
43 #include "OscException.h"
48 class OutOfBufferMemoryException :
public Exception{
50 OutOfBufferMemoryException(
const char *w=
"out of buffer memory" )
54 class BundleNotInProgressException :
public Exception{
56 BundleNotInProgressException(
57 const char *w=
"call to EndBundle when bundle is not in progress" )
61 class MessageInProgressException :
public Exception{
63 MessageInProgressException(
64 const char *w=
"opening or closing bundle or message while message is in progress" )
68 class MessageNotInProgressException :
public Exception{
70 MessageNotInProgressException(
71 const char *w=
"call to EndMessage when message is not in progress" )
76 class OutboundPacketStream{
78 OutboundPacketStream(
char *buffer, std::size_t capacity );
79 ~OutboundPacketStream();
83 std::size_t Capacity()
const;
86 std::size_t Size()
const;
88 const char *Data()
const;
94 bool IsMessageInProgress()
const;
95 bool IsBundleInProgress()
const;
97 OutboundPacketStream& operator<<(
const BundleInitiator& rhs );
98 OutboundPacketStream& operator<<(
const BundleTerminator& rhs );
100 OutboundPacketStream& operator<<(
const BeginMessage& rhs );
101 OutboundPacketStream& operator<<(
const MessageTerminator& rhs );
103 OutboundPacketStream& operator<<(
bool rhs );
104 OutboundPacketStream& operator<<(
const NilType& rhs );
105 OutboundPacketStream& operator<<(
const InfinitumType& rhs );
106 OutboundPacketStream& operator<<( int32 rhs );
108 #if !(defined(__x86_64__) || defined(_M_X64))
109 OutboundPacketStream& operator<<(
int rhs )
110 { *
this << (int32)rhs;
return *
this; }
113 OutboundPacketStream& operator<<(
float rhs );
114 OutboundPacketStream& operator<<(
char rhs );
115 OutboundPacketStream& operator<<(
const RgbaColor& rhs );
116 OutboundPacketStream& operator<<(
const MidiMessage& rhs );
117 OutboundPacketStream& operator<<( int64 rhs );
118 OutboundPacketStream& operator<<(
const TimeTag& rhs );
119 OutboundPacketStream& operator<<(
double rhs );
120 OutboundPacketStream& operator<<(
const char* rhs );
121 OutboundPacketStream& operator<<(
const Symbol& rhs );
122 OutboundPacketStream& operator<<(
const Blob& rhs );
124 OutboundPacketStream& operator<<(
const ArrayInitiator& rhs );
125 OutboundPacketStream& operator<<(
const ArrayTerminator& rhs );
129 char *BeginElement(
char *beginPtr );
130 void EndElement(
char *endPtr );
132 bool ElementSizeSlotRequired()
const;
133 void CheckForAvailableBundleSpace();
134 void CheckForAvailableMessageSpace(
const char *addressPattern );
135 void CheckForAvailableArgumentSpace( std::size_t argumentLength );
140 char *typeTagsCurrent_;
141 char *messageCursor_;
142 char *argumentCurrent_;
147 uint32 *elementSizePtr_;
149 bool messageIsInProgress_;