JUCE: OSCMessage Class Reference

JUCE

Public Member Functions | List of all members
OSCMessage Class Reference
juce_osc » osc

An OSC Message. More...

`#include <juce_OSCMessage.h>`

## Public Member Functions
| OSCMessage (const OSCAddressPattern &ap) noexcept
| Constructs an OSCMessage object with the given address pattern and no arguments. More...
template<typename Arg1 , typename... Args>
| OSCMessage (const OSCAddressPattern &ap, Arg1 &&arg1, Args &&... args)
| Constructs an OSCMessage object with the given address pattern and list of arguments. More...
void | setAddressPattern (const OSCAddressPattern &ap) noexcept
| Sets the address pattern of the OSCMessage. More...
OSCAddressPattern | getAddressPattern () const noexcept
| Returns the address pattern of the OSCMessage. More...
int | size () const noexcept
| Returns the number of OSCArgument objects that belong to this OSCMessage. More...
bool | isEmpty () const noexcept
| Returns true if the OSCMessage contains no OSCArgument objects; false otherwise. More...
OSCArgument & | operator[] (const int i) noexcept
| Returns a reference to the OSCArgument at index i in the OSCMessage object. More...
const OSCArgument & | operator[] (const int i) const noexcept
OSCArgument * | begin () noexcept
| Returns a pointer to the first OSCArgument in the OSCMessage object. More...
const OSCArgument * | begin () const noexcept
| Returns a pointer to the first OSCArgument in the OSCMessage object. More...
OSCArgument * | end () noexcept
| Returns a pointer to the last OSCArgument in the OSCMessage object. More...
const OSCArgument * | end () const noexcept
| Returns a pointer to the last OSCArgument in the OSCMessage object. More...
void | clear ()
| Removes all arguments from the OSCMessage. More...
void | addInt32 (int32 value)
| Creates a new OSCArgument of type int32 with the given value, and adds it to the OSCMessage object. More...
void | addFloat32 (float value)
| Creates a new OSCArgument of type float32 with the given value, and adds it to the OSCMessage object. More...
void | addString (const String &value)
| Creates a new OSCArgument of type string with the given value, and adds it to the OSCMessage object. More...
void | addBlob (MemoryBlock blob)
| Creates a new OSCArgument of type blob with binary data content copied from the given MemoryBlock. More...
void | addColour (OSCColour colour)
| Creates a new OSCArgument of type colour with the given value, and adds it to the OSCMessage object. More...
void | addArgument (OSCArgument argument)
| Adds the OSCArgument argument to the OSCMessage object. More...

## Detailed Description

An OSC Message.

An OSCMessage consists of an OSCAddressPattern and zero or more OSCArguments.

OSC messages are the elementary objects that are used to exchange any data via OSC. An OSCSender can send OSCMessage objects to an OSCReceiver.

## Constructor & Destructor Documentation

## ◆ OSCMessage()

OSCMessage::OSCMessage | ( | const OSCAddressPattern & | ap | ) |
| noexcept

Constructs an OSCMessage object with the given address pattern and no arguments.

Parameters

  ap | the address pattern of the message. This must be a valid OSC address (starting with a forward slash) and may contain OSC wildcard expressions. You can pass in a string literal or a juce String (they will be converted to an OSCAddressPattern automatically).

## Member Function Documentation

## ◆ setAddressPattern()

void OSCMessage::setAddressPattern | ( | const OSCAddressPattern & | ap | ) |
| noexcept

Sets the address pattern of the OSCMessage.

Parameters

  ap | the address pattern of the message. This must be a valid OSC address (starting with a forward slash) and may contain OSC wildcard expressions. You can pass in a string literal or a juce String (they will be converted to an OSCAddressPattern automatically).

## ◆ getAddressPattern()

OSCAddressPattern OSCMessage::getAddressPattern | ( |  | ) | const
| noexcept

Returns the address pattern of the OSCMessage.

## ◆ size()

int OSCMessage::size | ( |  | ) | const
| noexcept

Returns the number of OSCArgument objects that belong to this OSCMessage.

## ◆ isEmpty()

bool OSCMessage::isEmpty | ( |  | ) | const
| noexcept

Returns true if the OSCMessage contains no OSCArgument objects; false otherwise.

## ◆ operator[]() [1/2]

OSCArgument & OSCMessage::operator[] | ( | const int | i | ) |
| noexcept

Returns a reference to the OSCArgument at index i in the OSCMessage object.

This method does not check the range and results in undefined behaviour in case i < 0 or i >= size().

## ◆ operator[]() [2/2]

const OSCArgument & OSCMessage::operator[] | ( | const int | i | ) | const
| noexcept

## ◆ begin() [1/2]

OSCArgument * OSCMessage::begin | ( |  | ) |
| noexcept

Returns a pointer to the first OSCArgument in the OSCMessage object.

This method is provided for compatibility with standard C++ iteration mechanisms.

## ◆ begin() [2/2]

const OSCArgument * OSCMessage::begin | ( |  | ) | const
| noexcept

Returns a pointer to the first OSCArgument in the OSCMessage object.

This method is provided for compatibility with standard C++ iteration mechanisms.

## ◆ end() [1/2]

OSCArgument * OSCMessage::end | ( |  | ) |
| noexcept

Returns a pointer to the last OSCArgument in the OSCMessage object.

This method is provided for compatibility with standard C++ iteration mechanisms.

## ◆ end() [2/2]

const OSCArgument * OSCMessage::end | ( |  | ) | const
| noexcept

Returns a pointer to the last OSCArgument in the OSCMessage object.

This method is provided for compatibility with standard C++ iteration mechanisms.

## ◆ clear()

void OSCMessage::clear | ( |  | ) |

Removes all arguments from the OSCMessage.

## ◆ addInt32()

void OSCMessage::addInt32 | ( | int32 | value | ) |

Creates a new OSCArgument of type int32 with the given value, and adds it to the OSCMessage object.

## ◆ addFloat32()

void OSCMessage::addFloat32 | ( | float | value | ) |

Creates a new OSCArgument of type float32 with the given value, and adds it to the OSCMessage object.

## ◆ addString()

void OSCMessage::addString | ( | const String & | value | ) |

Creates a new OSCArgument of type string with the given value, and adds it to the OSCMessage object.

## ◆ addBlob()

void OSCMessage::addBlob | ( | MemoryBlock | blob | ) |

Creates a new OSCArgument of type blob with binary data content copied from the given MemoryBlock.

Note: If the argument passed is an lvalue, this may copy the binary data.

## ◆ addColour()

void OSCMessage::addColour | ( | OSCColour | colour | ) |

Creates a new OSCArgument of type colour with the given value, and adds it to the OSCMessage object.

## ◆ addArgument()

void OSCMessage::addArgument | ( | OSCArgument | argument | ) |

Adds the OSCArgument argument to the OSCMessage object.

Note: This method will result in a copy of the OSCArgument object if it is passed as an lvalue. If the OSCArgument is of type blob, this will also copy the underlying binary data. In general, you should use addInt32, addFloat32, etc. instead.

References gl::arg1.

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

- juce_OSCMessage.h