8567de90c15406a451dd684f28884e197c6f8feb
tdreszer
  Fri Mar 11 16:08:51 2011 -0800
Added const to a couple of APIs and changed some stuff to aid fleUi filterFiles functionality
diff --git src/hg/inc/mdb.h src/hg/inc/mdb.h
index 2324ad0..c29fcaa 100644
--- src/hg/inc/mdb.h
+++ src/hg/inc/mdb.h
@@ -242,54 +242,58 @@
 // returns the count of vars belonging to this obj or objs;
 
 int mdbByVarCount(struct mdbByVar *mdbByVars,boolean vars, boolean vals);
 // returns the count of objs belonging to this set of vars;
 
 // ----------------- Utilities -----------------
 struct mdbVar *mdbObjFind(struct mdbObj *mdbObj, char *var);
 // Finds the val associated with the var or retruns NULL
 
 char *mdbObjFindValue(struct mdbObj *mdbObj, char *var);
 // Finds the val associated with the var or retruns NULL
 
 boolean mdbObjContains(struct mdbObj *mdbObj, char *var, char *val);
 // Returns TRUE if object contains var, val or both
 
-boolean mdbObjsContainAtleastOne(struct mdbObj *mdbObjs, char *var);
+boolean mdbObjsContainAltleastOneMatchingVar(struct mdbObj *mdbObjs, char *var, char *val);
 // Returns TRUE if any object in set contains var
+#define mdbObjsContainAtleastOne(mdbObjs, var) mdbObjsContainAltleastOneMatchingVar((mdbObjs),(var),NULL)
 
 struct mdbObj *mdbObjsCommonVars(struct mdbObj *mdbObjs);
 // Returns a new mdbObj with all vars that are contained in every obj passed in.
 // Note that the returnd mdbObj has a meaningles obj name and vals.
 
 boolean mdbByVarContains(struct mdbByVar *mdbByVar, char *val, char *obj);
 // Returns TRUE if var contains val, obj or both
 
 void mdbObjReorderVars(struct mdbObj *mdbObjs, char *vars,boolean back);
 // Reorders vars list based upon list of vars "cell antibody treatment".  Send to front or back.
 
 void mdbObjsSortOnVars(struct mdbObj **mdbObjs, char *vars);
 // Sorts on var,val pairs vars lists: fwd case-sensitive.  Assumes all objs' vars are in identical order.
 // Optionally give list of vars "cell antibody treatment" to sort on (bringing to front of vars lists).
 
 void mdbObjsSortOnVarPairs(struct mdbObj **mdbObjs,struct slPair *varValPairs);
 // Sorts on var,val pairs vars lists: fwd case-sensitive.  Assumes all objs' vars are in identical order.
 // This method will use mdbObjsSortOnVars()
 
 void mdbObjRemoveVars(struct mdbObj *mdbObjs, char *vars);
 // Prunes list of vars for an object, freeing the memory.  Doesn't touch DB.
 
+void mdbObjRemoveHiddenVars(struct mdbObj *mdbObjs);
+// Prunes list of vars for mdb objs that have been declared as hidden in cv.ra typeOfTerms
+
 char *mdbRemoveCommonVar(struct mdbObj *mdbList, char *var);
 // Removes var from set of mdbObjs but only if all that hav it have a commmon val
 // Returns the val if removed, else NULL
 
 boolean mdbObjSetVar(struct mdbObj *mdbObj, char *var,char *val);
 // Sets the string value to a single var in an obj, preparing for DB update.
 // returns TRUE if updated, FALSE if added
 
 boolean mdbObjSetVarInt(struct mdbObj *mdbObj, char *var,int val);
 // Sets an integer value to a single var in an obj, preparing for DB update.
 // returns TRUE if updated, FALSE if added
 
 void mdbObjSwapVars(struct mdbObj *mdbObjs, char *vars,boolean deleteThis);
 // Replaces objs' vars with var=vap pairs provided, preparing for DB update.
 
@@ -357,43 +361,46 @@
 // Search the metaDb table for objs by var and val.  Can restrict by op "is", "like", "in" and accept (non-zero) limited string size
 // Search is via mysql, so it's case-insensitive.  Return is sorted on obj.
 
 struct mdbObj *mdbObjRepeatedSearch(struct sqlConnection *conn,struct slPair *varValPairs,boolean tables,boolean files);
 // Search the metaDb table for objs by var,val pairs.  Uses mdbCvSearchMethod() if available.
 // This method will use mdbObjsQueryByVars()
 
 struct slName *mdbObjNameSearch(struct sqlConnection *conn, char *var, char *val, char *op, int limit, boolean tables, boolean files);
 // Search the metaDb table for objs by var and val.  Can restrict by op "is" or "like" and accept (non-zero) limited string size
 // Search is via mysql, so it's case-insensitive.  Return is sorted on obj.
 
 struct slName *mdbValSearch(struct sqlConnection *conn, char *var, int limit, boolean tables, boolean files);
 // Search the metaDb table for vals by var.  Can impose (non-zero) limit on returned string size of val
 // Search is via mysql, so it's case-insensitive.  Return is sorted on val.
 
-struct slPair *mdbValLabelSearch(struct sqlConnection *conn, char *var, int limit, boolean tables, boolean files);
+struct slPair *mdbValLabelSearch(struct sqlConnection *conn, char *var, int limit, boolean tags, boolean tables, boolean files);
 // Search the metaDb table for vals by var and returns val (as pair->name) and controlled vocabulary (cv) label
 // (if it exists) (as pair->val).  Can impose (non-zero) limit on returned string size of name.
+// if requested, return cv tag instead of mdb val.  If requested, limit to table objs or file objs
 // Return is case insensitive sorted on label (cv label or else val).
 #define mdbPairVal(pair) (pair)->name
 #define mdbPairLabel(pair) (pair)->val
 
-struct hash *mdbCvTermHash(char *term);
+const struct hash *mdbCvTermHash(char *term);
 // returns a hash of hashes of a term which should be defined in cv.ra
+// NOTE: in static memory: DO NOT FREE
 
-struct hash *mdbCvTermTypeHash();
+const struct hash *mdbCvTermTypeHash();
 // returns a hash of hashes of mdb and controlled vocabulary (cv) term types
 // Those terms should contain label,descrition,searchable,cvDefined,hidden
+// NOTE: in static memory: DO NOT FREE
 
 struct slPair *mdbCvWhiteList(boolean searchTracks, boolean cvLinks);
 // returns the official mdb/controlled vocabulary terms that have been whitelisted for certain uses.
 
 enum mdbCvSearchable
 // metadata Variavble are only certain declared types
     {
     cvsNotSearchable        =0,  // Txt is default
     cvsSearchByMultiSelect  =1,  // Search by drop down multi-select of supplied list (NOT YET IMPLEMENTED)
     cvsSearchBySingleSelect =2,  // Search by drop down single-select of supplied list
     cvsSearchByFreeText     =3,  // Search by free text field (NOT YET IMPLEMENTED)
     cvsSearchByDateRange    =4,  // Search by discovered date range (NOT YET IMPLEMENTED)
     cvsSearchByIntegerRange =5   // Search by discovered integer range (NOT YET IMPLEMENTED)
     };