usr/kevin/code/develop/sim_gil_obj.c
int gil_comp_encode(const gil_comp_t * obj, u_json_t ** json) {

  u_json_t * jc = NULL;
  u_json_t * jobj = NULL;

  dbg_return_if(obj == NULL, -1);
  dbg_return_if(json == NULL, -1);

  dbg_err_if(u_json_new_object(NULL, &jc));
  dbg_err_if(u_json_new_string("Name", u_string_c(obj->name), &jobj));
  dbg_err_if(u_json_add(jc, jobj));
  dbg_err_if(u_json_new_int("Value", obj->value, &jobj));
  dbg_err_if(u_json_add(jc, jobj));
  *json = jc;

  return 0;

 err:
  u_json_free(jobj);
  u_json_free(jc);

  return -1;
}
/*****************************************************************************
 *
 *  \brief Encode and return json parse tree for a Gillespie component
 *
 *  \param obj     pointer to the object to be encoded
 *  \param json    pointer to the new u_json_t object to be returned
 *
 *  \retval 0      a success
 *  \retval -1     a failure
 *
 *****************************************************************************/
\brief Encode and return json parse tree for a Gillespie component
\param obj     pointer to the object to be encoded
\param json    pointer to the new u_json_t object to be returned

\retval 0      a success
\retval -1     a failure
\ brief Encode and return json parse tree for a Gillespie component \ param obj pointer to the object to be encoded \ param json pointer to the new u_json_t object to be returned \ retval 0 a success \ retval - 1 a failure
int gil_comp_encode(const gil_comp_t * obj, u_json_t ** json) {
  u_json_t * jc = NULL;
  u_json_t * jobj = NULL;
  dbg_return_if(obj == NULL, -1);
  dbg_return_if(json == NULL, -1);
  dbg_err_if(u_json_new_object(NULL, &jc));
  dbg_err_if(u_json_new_string("Name", u_string_c(obj->name), &jobj));
  dbg_err_if(u_json_add(jc, jobj));
  dbg_err_if(u_json_new_int("Value", obj->value, &jobj));
  dbg_err_if(u_json_add(jc, jobj));
  *json = jc;
  return 0;
 err:
  u_json_free(jobj);
  u_json_free(jc);
  return -1;
}
int gil_comp_encode ( const gil_comp_t * obj , u_json_t * * json ) { u_json_t * jc = NULL ; u_json_t * jobj = NULL ; dbg_return_if ( obj == NULL , -1 ) ; dbg_return_if ( json == NULL , -1 ) ; dbg_err_if ( u_json_new_object ( NULL , & jc ) ) ; dbg_err_if ( u_json_new_string ( " " , u_string_c ( obj -> name ) , & jobj ) ) ; dbg_err_if ( u_json_add ( jc , jobj ) ) ; dbg_err_if ( u_json_new_int ( " " , obj -> value , & jobj ) ) ; dbg_err_if ( u_json_add ( jc , jobj ) ) ; * json = jc ; return 0 ; err : u_json_free ( jobj ) ; u_json_free ( jc ) ; return -1 ; }
\brief Encode and return json parse tree for a Gillespie component
  \param obj     pointer to the object to be encoded
  \param json    pointer to the new u_json_t object to be returned
\ brief Encode and return json parse tree for a Gillespie component \ param obj pointer to the object to be encoded \ param json pointer to the new u_json_t object to be returned