void TuioClient::ProcessBundle( const ReceivedBundle& b, const IpEndpointName& remoteEndpoint) { try { for( ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){ if( i->IsBundle() ) ProcessBundle( ReceivedBundle(*i), remoteEndpoint); else ProcessMessage( ReceivedMessage(*i), remoteEndpoint); } } catch (MalformedBundleException& e) { std::cerr << "malformed OSC bundle" << std::endl << e.what() << std::endl; } }
void TUIOInputDevice::processBundle(const ReceivedBundle& bundle) { try { for (ReceivedBundle::const_iterator it = bundle.ElementsBegin(); it != bundle.ElementsEnd(); ++it) { if (it->IsBundle()) { processBundle(ReceivedBundle(*it)); } else { processMessage(ReceivedMessage(*it)); } } } catch (osc::Exception& e) { AVG_LOG_WARNING("OSC exception: " << e.what()); } }
std::ostream& operator<<( std::ostream & os, const ReceivedBundle& b ) { static int indent = 0; for( int j=0; j < indent; ++j ) os << " "; os << "{ ( "; if( b.TimeTag() == 1 ) os << "immediate"; else os << b.TimeTag(); os << " )\n"; ++indent; for( ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){ if( i->IsBundle() ){ ReceivedBundle b(*i); os << b << "\n"; }else{ ReceivedMessage m(*i); for( int j=0; j < indent; ++j ) os << " "; os << m << "\n"; } } --indent; for( int j=0; j < indent; ++j ) os << " "; os << "}"; return os; }