Main Page | Data Structures | Directories | File List | Data Fields | Globals

ks_response.h File Reference

Interface to libkarmaclient's bquery response packet. More...

#include "ks_assoc.h"
#include "ks_string.h"
#include "ks_combination.h"
#include "ks_fact.h"

Go to the source code of this file.

Data Structures

struct  _ks_response_t

Typedefs

typedef _ks_response_t ks_response_t

Functions

ks_type_tks_response_type (void)
ks_response_tks_response_bparse (const char *, int)
void ks_response_free (ks_response_t *)
ks_string_tks_response_error (ks_response_t *)
ks_string_tks_response_message (ks_response_t *)
ks_string_tks_response_id (ks_response_t *)
long ks_response_time (ks_response_t *)
int ks_response_combinations_size (ks_response_t *)
ks_assoc_tks_response_combinations (ks_response_t *e)
ks_combination_tks_response_combination (ks_response_t *, const char *)
int ks_response_facts_length (ks_response_t *)
ks_fact_tks_response_fact (ks_response_t *, int)


Detailed Description

Interface to libkarmaclient's bquery response packet.

Type and function declarations for the functions defined in ks_response.c. Do not include this file directly in your client. Instead, include the application header file, ks.h, which will include all the libkarmaclient header files for you.

Definition in file ks_response.h.


Typedef Documentation

typedef struct _ks_response_t ks_response_t
 

libkarmaclient response type.


Function Documentation

ks_response_t* ks_response_bparse const char *  data,
int  len
 

XXX

Definition at line 90 of file ks_response.c.

References _ks_response_t::error, ks_assoc_type(), ks_bparse(), KS_CAST, ks_error(), ks_string_type(), _ks_type_t::name, _ks_response_t::response, and _ks_base_t::type.

ks_combination_t* ks_response_combination ks_response_t e,
const char *  key
 

Get a specific combination result from ks_response_t (e).

Parameters:
e the ks_response_t to retrieve the combination result from.
key a '' terminated string which is the name of the combination result to retreive.
Returns:
NULL if there are no combination results, or there is no combinations with the name key.

Definition at line 250 of file ks_response.c.

References ks_assoc_get(), KS_CAST, and ks_response_combinations().

ks_assoc_t* ks_response_combinations ks_response_t e  ) 
 

Get all the combinations in ks_response_t (e)

Parameters:
e the ks_response_t to retrieve the combinations from.
Returns:
NULL or a ks_assoc_t containing all the combination matches returned from the server.

Definition at line 226 of file ks_response.c.

References ks_assoc_get(), KS_CAST, and _ks_response_t::response.

Referenced by ks_response_combination(), and ks_response_combinations_size().

int ks_response_combinations_size ks_response_t e  ) 
 

Get the number of combinations contained in ks_response_t (e)

Parameters:
e the ks_response_t to retrieve the number of combination results from.
Returns:
0 in the case there are no combinations, or the number of combinations contained in e otherwise.

Definition at line 271 of file ks_response.c.

References ks_assoc_size(), and ks_response_combinations().

ks_string_t* ks_response_error ks_response_t e  ) 
 

Returns the error string contained in the ks_response_t (e), which must not be NULL, and must point to a valid ks_response_t structure.

Parameters:
e the ks_response_t from which to get the error message.
Returns:
NULL or the ks_string_t containing an error string.

Definition at line 140 of file ks_response.c.

References _ks_response_t::error, ks_assoc_get(), ks_response_message(), ks_string_new(), and _ks_response_t::response.

ks_fact_t* ks_response_fact ks_response_t e,
int  idx
 

Get a specific fact contained in ks_response_t (e)

Parameters:
e the ks_response_t to retrieve a ks_fact_t from.
idx The index of the fact to retrieve.
Returns:
NULL if there are no facts, or idx is outside it's bounds, a ks_fact_t containing the fact at the index otherwise.

Definition at line 325 of file ks_response.c.

References ks_array_get().

int ks_response_facts_length ks_response_t e  ) 
 

Get the number of facts contained in ks_response_t (e)

Parameters:
e the ks_response_t to retrieve the number of facts from.
Returns:
0 in the case there are no facts, or the number of facts contained in e otherwise.

Definition at line 308 of file ks_response.c.

References ks_array_length().

void ks_response_free ks_response_t e  ) 
 

Destroy a given ks_response_t and free all memory that has been allocated for it and any elements it contains.

Parameters:
e a pointer to the ks_response_t to be destroyed
Returns:
Nothing

Definition at line 123 of file ks_response.c.

References _ks_response_t::error, ks_assoc_free(), ks_free(), ks_string_free(), and _ks_response_t::response.

Referenced by main().

ks_string_t* ks_response_id ks_response_t e  ) 
 

Get the response id of ks_response_t (e).

Parameters:
e the ks_response_t to get the id for.
Returns:
NULL or the ks_string_t containing the response id.

Definition at line 184 of file ks_response.c.

References ks_assoc_get(), KS_CAST, and _ks_response_t::response.

Referenced by ks_socket_recv().

ks_string_t* ks_response_message ks_response_t e  ) 
 

Returns the message string contained in the ks_response_t (e)

Parameters:
e the ks_response_t from which to get the message.
Returns:
NULL or the ks_string_t containing a message string.

Definition at line 169 of file ks_response.c.

References ks_assoc_get(), KS_CAST, and _ks_response_t::response.

Referenced by ks_response_error().

long ks_response_time ks_response_t e  ) 
 

Get the query time from ks_response_t (e)

Parameters:
e the ks_response_t containing the query time.
Returns:
-1 when the response does not contain a query time, or a long which is the server side query time in milliseconds.

Definition at line 203 of file ks_response.c.

References ks_assoc_get(), KS_CAST, ks_number_get(), and _ks_response_t::response.

ks_type_t* ks_response_type void   ) 
 

Get the metaclass for ks_response_t objects.

Returns:
A pointer to ks_reponse's metaclass.

Definition at line 65 of file ks_response.c.


Generated on Tue Aug 7 21:11:31 2007 for libkarmaclient by  doxygen 1.4.4