The YAZ C++ API is an client - and server API that exposes
all YAZ features. The API doesn't hide YAZ C data structures, but
provides a set of useful high-level objects for creating clients -
and servers.
The following sections include a short description of the
interfaces and implementations (concrete classes).
In order to understand the structure, you should look at the
example client yaz-my-client.cpp and
the example server yaz-my-server.cpp.
If that is too easy, you can always turn to the implementation
of the proxy itself and send us a patch if you implement a new
useful feature.
Note:
The documentation here is very limited. We plan to enhance it -
provided there is interest for it.
#include <yaz++/socket-observer.h>
class my_socketobserver : public IYazSocketObserver {
public:
// Notify the observer that something happened to socket
virtual void socketNotify(int event) = 0;
}
#include <yaz++/pdu-observer.h>
class my_pduobserver : public IYaz_PDU_Observer {
public:
// A PDU has been received
virtual void recv_PDU(const char *buf, int len) = 0;
// Called when Iyaz_PDU_Observable::connect was successful.
virtual void connectNotify() = 0;
// Called whenever the connection was closed
virtual void failNotify() = 0;
// Called whenever there is a timeout
virtual void timeoutNotify() = 0;
// Make clone of observer using IYaz_PDU_Observable interface
virtual IYaz_PDU_Observer *sessionNotify(
IYaz_PDU_Observable *the_PDU_Observable, int fd) = 0;
};
#include <yaz++/query.h>
class my_query : public Yaz_Query {
public:
// Print query in buffer described by str and len
virtual void print (char *str, int len) = 0;
};