The C++ Binding

4th November 2002

C++ Binding Specification

The C++ binding is maintained by Ashley Sanders <ashley.sanders@man.ac.uk> with unwarranted interference from Mike Taylor <mike@z3950.org>

The C++ binding is documented in chapter two (``ZOOM-C++'') of the manual for Index Data's YAZ++ toolkit, which contains an implementation (see below).

More formally, the programming interface is defined by a C++ header file. You probably want the current version, but the following older versions are also available:

In all cases, the behaviour of the various methods is supposed to be obvious in the light of the abstract specifications in the API.

Canonical Sample Program

To give a flavour of the C++ binding, here is ZOOM's equivalent of the ``Hello World'' program: 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.

#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");
  resultSet rs (conn, prefixQuery ("@attr 1=7 0253333490"));
  const record rec(rs, 0);
  std::cout << rec.render () << std::endl;
}

C++ Binding Implementations

We currently have the following implementations of the C binding:

Commentary

Here we present a rationale for some of the decisions made in the C++ binding specification. This section will grow as we gain more implementation experience.

Bonus: zstream

Ashley Sanders has also contributed zstream, a layer above ZOOM that provides iostream-like access to Z39.50 functionality in C++. It is described, and available for download, at www.mimas.ac.uk/~zzaascs/zstream

Feedback to <mike@indexdata.com> is welcome!