Chapter 3. ZOOM-C++
Prev |  | Next

## Chapter 3. ZOOM-C++

## 1. Introduction

ZOOM is the emerging standard API for information retrieval programming using the Z39.50 protocol. ZOOM's Abstract API specifies semantics for classes representing key IR concepts such as connections, queries, result sets and records; and there are various bindings specifying how those concepts should be represented in various programming languages.

The YAZ++ library includes an implementation of the C++ binding for ZOOM, enabling quick, easy development of client applications.

For example, here is a tiny Z39.50 client that fetches and displays the MARC record for Farlow & Brett Surman's The Complete Dinosaur from the Library of Congress's Z39.50 server:

        #include <iostream>
        #include <yazpp/zoom.h>

        using namespace ZOOM;

        int main(int argc, char **argv)
        {
            connection conn("z3950.loc.gov", 7090);
            conn.option("databaseName", "Voyager");
            conn.option("preferredRecordSyntax", "USMARC");
            resultSet rs(conn, prefixQuery("@attr 1=7 0253333490"));
            const record *rec = rs.getRecord(0);
            cout << rec->render() << endl;
        }

### Note

For the sake of simplicity, this program does not check for errors: we show a more robust version of the same program later.)

YAZ++'s implementation of the C++ binding is a thin layer over YAZ's implementation of the C binding. For information on the supported options and other such details, see the ZOOM-C documentation, which can be found on-line at http://www.indexdata.com/yaz/doc/zoom.html

All of the classes defined by ZOOM-C++ are in the `ZOOM` namespace. We will now consider the five main classes in turn:

- `connection`

- `query` and its subclasses `prefixQuery` and `CCLQuery`

- `resultSet`

- `record`

- `exception` and its subclasses `systemException`, `bib1Exception` and `queryException`

Prev |  | Next
2. Installation on Windows | Home | 2. `ZOOM::connection`