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