oscpkt::PacketWriter Class Reference

#include <oscpkt.hh>

List of all members.

Public Member Functions

PacketWriterinit ()
PacketWriterstartBundle (TimeTag ts=TimeTag::immediate())
PacketWriterendBundle ()
PacketWriteraddMessage (const Message &msg)
bool isOk ()
ErrorCode getErr ()
uint32_t packetSize ()
char * packetData ()

Detailed Description

Assemble messages into an OSC packet. Example of use:

   PacketWriter pkt; 
   Message msg;
   pkt.startBundle(); 
   pkt.addMessage(msg.init("/foo").pushBool(true).pushStr("plop").pushFloat(3.14f));
   pkt.addMessage(msg.init("/bar").pushBool(false));
   pkt.endBundle();
   if (pkt.isOk()) {
     send(pkt.data(), pkt.size());
   }
Examples:

oscpkt_demo.cc, and oscpkt_test.cc.


Member Function Documentation

PacketWriter& oscpkt::PacketWriter::addMessage ( const Message msg  )  [inline]

insert an Osc message into the current bundle / packet.

Examples:
oscpkt_demo.cc, and oscpkt_test.cc.
PacketWriter& oscpkt::PacketWriter::endBundle (  )  [inline]

close the current bundle.

Examples:
oscpkt_demo.cc, and oscpkt_test.cc.
bool oscpkt::PacketWriter::isOk (  )  [inline]

the error flag will be raised if an opened bundle is not closed, or if more than one message is inserted in the packet without a bundle

Examples:
oscpkt_test.cc.
char* oscpkt::PacketWriter::packetData (  )  [inline]

return the bytes of the osc packet (NULL if the construction of the packet has failed)

Examples:
oscpkt_demo.cc, and oscpkt_test.cc.
uint32_t oscpkt::PacketWriter::packetSize (  )  [inline]

return the number of bytes of the osc packet -- will always be a multiple of 4 -- returns 0 if the construction of the packet has failed.

Examples:
oscpkt_demo.cc, and oscpkt_test.cc.
PacketWriter& oscpkt::PacketWriter::startBundle ( TimeTag  ts = TimeTag::immediate()  )  [inline]

begin a new bundle. If you plan to pack more than one message in the Osc packet, you have to put them in a bundle. Nested bundles inside bundles are also allowed.

Examples:
oscpkt_demo.cc, and oscpkt_test.cc.

The documentation for this class was generated from the following file:
 All Classes Functions

Generated by  doxygen 1.6.2