src/hg/instinct/inc/json.h 1.2

1.2 2009/06/04 03:47:23 jsanborn
added copyright notices, removed cluster library
Index: src/hg/instinct/inc/json.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/inc/json.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/hg/instinct/inc/json.h	6 Nov 2008 19:02:50 -0000	1.1
+++ src/hg/instinct/inc/json.h	4 Jun 2009 03:47:23 -0000	1.2
@@ -1,79 +1,83 @@
+/********************************************************************************/
+/* Copyright 2007-2009 -- The Regents of the University of California           */
+/********************************************************************************/
+
 /* json.h - interfaces to plug data into JSON object for talking to JavaScript client */
 
 #ifndef JSON_H
 #define JSON_H
 
 #include "cart.h"
 #include "jksql.h"
 
 struct jsonDouble {
     double val;
 };
 
 struct jsonObject
 /* a jsonObject... contains a void * reference to object...  pseudo object-oriented
  * approach */
 {
     /* Data set during initialization that is guaranteed to be in each column.  */
     struct jsonObject *next;   /* Next object */
 
     char *name;  /* Object name. */
     void *data;  /* reference to data */
 
     /* -- Methods -- */
     void (*appendVal)(struct jsonObject *jo, struct dyString *dy);
     /* Get value of one cell as string.  FreeMem this when done.  Note that
      * gp->chrom may be NULL legitimately. */
 };
 
 struct json
 /* Container for list of objects */
 {
     struct json *next;    /* Next container. */
 
     char *name;  /* Container name */
     struct jsonObject *objects;   
 
     /* -- Methods -- */
     char *(*print)(struct json *js);
     /* Print JSON object into string, ready for output */
 };
 
 struct json *newJson();
 /* Allocate new JSON root container object, delimited by ({ ... }) */
 
 void jsonAddInt(struct json *js, char *name, int val);
 /* Add named integer to container js */
 
 void jsonAddSlInt(struct json *js, char *name, struct slInt *slList);
 /* Add named integer list (slInt) to container js */
 
 void jsonAddDouble(struct json *js, char *name, double val);
 /* Add named double to container js, shallow copy! */
 
 void jsonAddSlDouble(struct json *js, char *name, struct slDouble *slList);
 /* Add named double list (slDouble) to container js, shallow copy! */
 
 void jsonAddString(struct json *js, char *name, char *str);
 /* Add named string to container js */
 
 void jsonAddSlName(struct json *js, char *name, struct slName *slList);
 /* Add named string list (slName) to container js, shallow copy! */
 
 struct json *jsonAddContainer(struct json *js, char *name); 
 /* Add named container to container js */
 
 struct json *jsonAddContainerList(struct json *js, char *name);
 /* Add new container list to container js, returns pointer to container list */
 
 struct json *jsonAddContainerToList(struct json **jsList);
 /* Add new container to container list jsList, returns pointer to container 
  * being added */
 
 void jsonEarlyWarningHandler(char *format, va_list args);
 /* send error to client via JSON-formatted object, to avoid parsing error */
 
 void jsonWarnAbort(char *line, ...);
 /* send warning to client via JSON-formatted object, to avoid parsing error */
 
 #endif /* JSON_H */