2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: yaz-z-query.cpp,v $
7 * Revision 1.1 1999-03-23 14:17:57 adam
8 * More work on timeout handling. Work on yaz-client.
12 #include <yaz-z-query.h>
15 Yaz_Z_Query::Yaz_Z_Query()
17 odr_encode = odr_createmem (ODR_ENCODE);
18 odr_decode = odr_createmem (ODR_DECODE);
21 void Yaz_Z_Query::set_rpn (const char *rpn)
24 odr_reset (odr_encode);
25 Z_Query *query = (Z_Query*) odr_malloc (odr_encode, sizeof(*query));
26 query->which = Z_Query_type_1;
27 query->u.type_1 = p_query_rpn (odr_encode, PROTO_Z3950, rpn);
30 if (!z_Query (odr_encode, &query, 0))
32 buf = odr_getbuf (odr_encode, &len, 0);
35 void Yaz_Z_Query::set_Z_Query(Z_Query *z_query)
38 odr_reset (odr_encode);
39 if (!z_Query (odr_encode, &z_query, 0))
41 buf = odr_getbuf (odr_encode, &len, 0);
44 Yaz_Z_Query::~Yaz_Z_Query()
46 odr_destroy (odr_encode);
47 odr_destroy (odr_decode);
50 Z_Query *Yaz_Z_Query::get_Z_Query ()
55 odr_setbuf (odr_decode, buf, len, 0);
56 if (!z_Query(odr_decode, &query, 0))
61 void Yaz_Z_Query::print(char *str, int len)