src/hg/inc/trackDb.h 1.55

1.55 2010/04/01 23:51:46 tdreszer
Added extras hash to the tdb struct and 2 APIs to use it
Index: src/hg/inc/trackDb.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/inc/trackDb.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -b -B -U 4 -r1.54 -r1.55
--- src/hg/inc/trackDb.h	25 Mar 2010 17:27:26 -0000	1.54
+++ src/hg/inc/trackDb.h	1 Apr 2010 23:51:46 -0000	1.55
@@ -52,8 +52,10 @@
     struct hash *overrides;     /* If not NULL, this is an override
                                  * entry.  It contains the names, but not the
                                  * values of the fields and settings that were
                                  * specified in the entry. */
+    struct hash *extras;        /* This hash allows storing extra values which may be used multiple times within a single cgi
+                                   And example is the metadata looked looked up once in the metaTbl and used again and again. */
     };
 
 #define SUPERTRACK_MASK                 0x10
 #define COMPOSITE_MASK                  0x20
@@ -291,8 +293,11 @@
 
 struct trackDb *tdbFindOrCreate(char *db,struct trackDb *parent,char *table);
 /* Find or creates the tdb for this table. May return NULL. */
 
+// TODO: metadata as a trackDb will be obsoleted soon so these routines should be removed.
+// TODO: metadata as a trackDb will be obsoleted soon so these routines should be removed.
+// TODO: metadata as a trackDb will be obsoleted soon so these routines should be removed.
 typedef struct _metadata {
     int count;
     char**tags;
     char**values;
@@ -307,8 +312,17 @@
 
 char *metadataSettingFind(struct trackDb *tdb,char *name);
 /* Looks for a specific metadata setting and returns the value or null
    returned value should be freed */
+// TODO: metadata as a trackDb will be obsoleted soon so these routines should be removed.
+// TODO: metadata as a trackDb will be obsoleted soon so these routines should be removed.
+// TODO: metadata as a trackDb will be obsoleted soon so these routines should be removed.
+
+void tdbExtrasAddOrUpdate(struct trackDb *tdb,char *name,void *value);
+/* Adds some "extra" nformation to the extras hash.  Creates hash if necessary. */
+
+void *tdbExtrasGetOrDefault(struct trackDb *tdb,char *name,void *defaultVal);
+/* Returns a value if it is found in the extras hash. */
 
 void parseColor(char *text, unsigned char *r, unsigned char *g, unsigned char *b);
 /* Turn comma-separated string of three numbers into three
  * color components. */