00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef RAUL_ATOM_LIBLO_HPP
00019 #define RAUL_ATOM_LIBLO_HPP
00020
00021 #include <lo/lo.h>
00022 #include <raul/Atom.hpp>
00023
00024 namespace Raul {
00025
00030 namespace AtomLiblo {
00031
00033 inline void
00034 lo_message_add_atom(lo_message m, const Atom& atom)
00035 {
00036 switch (atom.type()) {
00037 case Atom::INT:
00038 lo_message_add_int32(m, atom.get_int32());
00039 break;
00040 case Atom::FLOAT:
00041 lo_message_add_float(m, atom.get_float());
00042 break;
00043 case Atom::STRING:
00044 lo_message_add_string(m, atom.get_string());
00045 break;
00046 case Atom::BLOB:
00047
00048 lo_message_add_blob(m, const_cast<void*>(atom.get_blob()));
00049 break;
00050 case Atom::NIL:
00051 default:
00052 lo_message_add_nil(m);
00053 break;
00054 }
00055 }
00056
00057
00059 inline Atom
00060 lo_arg_to_atom(char type, lo_arg* arg)
00061 {
00062 switch (type) {
00063 case 'i':
00064 return Atom(arg->i);
00065 case 'f':
00066 return Atom(arg->f);
00067 case 's':
00068 return Atom(&arg->s);
00069
00070
00071
00072 default:
00073 return Atom();
00074 }
00075 }
00076
00077
00078 }
00079 }
00080
00081 #endif // RAUL_ATOM_LIBLO_HPP