Chapter 1. Introduction

Table of Contents

Basic concepts

This document guides you through the various steps of writing an URBI C++ component using the UObject API. This API can be used to add new objects written in C++ to the URBI language, and to interact from C++ with the objects that are already defined. We cover the use cases of controlling a physical device (servomotor, speaker, camera...), and interfacing higher-lever components (voice recognition, object detection,...) with URBI.

Basic concepts

The API defines the UObject class. Each instance of a derived class in your C++ code will correspond to an URBI object sharing some of its methods and attributes. The API provides methods to declare which elements of your object are to be shared. To share a variable with URBI, you have to give it the type UVar. This type is a container that provides cast and equal operators for all types known to URBI: double, string and char*, and the binary-holding structures UBinary, USound and UImage. This type can also read from and write to the liburbi UValue class. The API provides methods to set up callbacks functions that will be notified when a variable is modified or read from URBI code. Instance methods of any prototype can be rendered accessible from URBI, providing all the parameters types and the return type can be converted to/from UValue.

The next chapter is a walk through covering all the aspects of the UObject API, and the rest of the document describes many use cases in details.