Changed everything towards LDC2 use.
[h316.git] / pc-tools / ldc2 / src / tool.hh
CommitLineData
4741aa72 1/******************************************************************************
2 *
3 * LDC2 source code
4 *
fe67c7be 5 * $Date: 2007/05/30 02:51:16 $
4741aa72 6 * $Author: hachti $
7 *
8 * $Log: tool.hh,v $
fe67c7be 9 * Revision 2.1 2007/05/30 02:51:16 hachti
10 * Changed everything towards LDC2 use.
11 * Worked on the buildlib.sh.
12 * Centralized buildlib.sh to a new lib/common directory.
13 *
14 * Revision 2.0 2007-03-26 01:00:40 hachti
4741aa72 15 * *** empty log message ***
16 *
17 *
18 ******************************************************************************/
19
ea4c19a4 20#ifndef TOOL_HH
21#define TOOL_HH
22
23#include <vector>
24#include <string>
25
26using namespace std;
27
28extern int dump_vector(vector<string> strings);
874a2bd8 29extern int dump_vector_fp(vector<string> strings, FILE * fp);
30
874a2bd8 31
de6b6757 32/*!
33 *\brief add contents of one vector to another vector uniquely.
34 *\param target Reference to the target vector.
35 *\param source Reference to the vector whose contents are to be added
36 * to target.
37 */
38template<typename T>
39void merge_vector_unique(vector<T> &target, const vector<T> & source){
40 for (unsigned int isource=0; isource<source.size();isource++){
41 bool already_present=false;
42 for (unsigned int itarget=0;itarget<target.size();itarget++)
43 if (target[itarget]==source[isource]){
44 already_present=true;
45 break;
46 }
fe67c7be 47 if (!already_present) target.insert(target.begin(),source[isource]);
de6b6757 48 }
49}
ea4c19a4 50
51#endif