Changed everything towards LDC2 use.
[h316.git] / pc-tools / ldc2 / src / tool.hh
index acb30ec35eb585840b350dfb7a0513387a88cc31..1f5008b281d224ef201a077cb5e111ff4f3f1604 100644 (file)
@@ -1,3 +1,22 @@
+/******************************************************************************
+ * 
+ * LDC2 source code
+ *
+ * $Date: 2007/05/30 02:51:16 $
+ * $Author: hachti $
+ *
+ * $Log: tool.hh,v $
+ * Revision 2.1  2007/05/30 02:51:16  hachti
+ * Changed everything towards LDC2 use.
+ * Worked on the buildlib.sh.
+ * Centralized  buildlib.sh to a new lib/common directory.
+ *
+ * Revision 2.0  2007-03-26 01:00:40  hachti
+ * *** empty log message ***
+ *
+ *
+ ******************************************************************************/
 #ifndef TOOL_HH
 #define TOOL_HH
 
@@ -7,6 +26,26 @@
 using namespace std;
 
 extern int dump_vector(vector<string> strings);
-extern int dump_vector_err(vector<string> strings);
+extern int dump_vector_fp(vector<string> strings, FILE * fp);
+
+
+/*!
+ *\brief add contents of one vector to another vector uniquely.
+ *\param target Reference to the target vector.
+ *\param source Reference to the vector whose contents are to be added
+ *       to target.
+ */
+template<typename T>
+void merge_vector_unique(vector<T> &target, const vector<T> & source){
+  for (unsigned int isource=0; isource<source.size();isource++){
+    bool already_present=false;
+    for (unsigned int itarget=0;itarget<target.size();itarget++)
+      if (target[itarget]==source[isource]){
+       already_present=true;
+       break;
+      }
+    if (!already_present) target.insert(target.begin(),source[isource]);
+  }
+}
 
 #endif