#Overview
An OSCBundle is a group of OSCMessages. OSCBundle is an implementation of OSC Bundles with support for the four basic data types and 64-bit timetags. OSCBundles are the preferred method for sending OSCMessages because the OSCBundle manages the memory of the OSCMessages, timetag support, and integrity of all the OSCMessages contained in the OSCBundle.

#Creating an OSCBundle.

OSCBundle bndl ; //constructs the bundle

#Filling a OSCBundle with OSCMessages
To make an OSCBundle simply declare it in the sketch. Once declared, OSCMessages can be added to the OSCBundle using the add method,add returns the OSCMessage that was added to the bundle so that the OSCMessage's add method can be invoked right away.

bndl.add("/alpha").add(1);
bndl.add("/beta").add(2).add("two");

#Getting OSCMessages from the OSCBundle
To get OSCMessages out of the OSCBundle, use the getOSCMessage method. Get OSCMessages either by their position in the OSCBundle (the position in the bundle is the same as the order that it was added) or by matching a pattern (the first message that matches the pattern will be returned).

OSCBundle bndl;
bndl.add("/a");
bndl.add("/b");
//all of these return the same OSCMessage
bndl.getOSCMessage("/a");
bndl.getOSCMessage("/[a-b]");
bndl.getOSCMessage(0);

#Dispatching and Routing
OSCBundle has the same dispatch and route methods as OSCMessage, but for OSCBundle the pattern and callback function are applied to every message that is contained in the bundle.


void frequencyCallback(OSCMessage & msg, int offset){
   float freq = msg.getFloat();
}

void oscillatorCallback(OSCMessage & msg, int offset){
   msg.route("/freq", frequencyCallback, offset);
}
OSCBundle bndl;
bndl.add("/oscillator/freq").add(440.0);
bndl.add("/oscillator/amp").add(1.0);
bndl.route("/oscillator", oscillatorCallback);

#Input/Output
OSCBundles can use send() and fill() to write to or read from a byte stream.

OSCBundle bndl(Serial);
bndl.add("/1").add(1.0);
bndl.add("/2").add("two");
bndl.send(SlipSerial); //send the two messages over Slip Serial