ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/utils/Utility.hpp
Revision: 1823
Committed: Thu Dec 2 02:23:45 2004 UTC (19 years, 7 months ago) by tim
File size: 1804 byte(s)
Log Message:
begin to fix linking problem

File Contents

# User Rev Content
1 gezelter 1490 #ifndef _UTILITY_H_
2     #define _UTILITY_H_
3     #include <vector>
4     #include <math.h>
5 tim 1823 #include "utils/next_combination.hpp"
6 tim 1816
7 tim 1823 namespace oopse {
8 tim 1727 inline double roundMe( double x ){
9     return ( x >= 0 ) ? floor( x + 0.5 ) : ceil( x - 0.5 );
10     }
11    
12 tim 1823 /**
13     * @brief iteratively replace the sequence with wild cards
14     * @return true if more combination sequence is avaliable, otherwise return true
15     * @param cont iterator container, if expect the whole series of combinations, pass an empty iterator
16     * container. The user should not modify this iterator container
17     * @param sequence the whole sequence used to generate combination
18     * @param result a possible combination sequence which is set on return
19     * @param wildCard the wild card string. Its value is "X" by default
20     * @note since next_combination never returns an empty sequence, replaceWildCard will not generate
21     * one special combination, which is n identical wild cards (n is equal to the size of the passing sequence)
22     *
23     * @code
24     * std::vector<std::string> sv;
25     * std::vector<std::vector<std::string>::iterator> sic;
26     * std::vector<std::string> resultString;
27     * sv.push_back("H");
28     * sv.push_back("C");
29     * sv.push_back("N");
30    
31     * while (replaceWithWildCard(sic, sv, resultString)) {
32     * for(std::vector<std::string>::iterator i = resultString.begin(); i != resultString.end(); ++i) {
33     * std::cout << *i << "\t";
34     * }
35     * std::cout << std::endl;
36     * }
37     * //output
38     * //H X X
39     * //X C X
40     * //X X N
41     * //H C X
42     * //H X N
43     * //X C N
44     * //H C N
45     * @endcode
46     */
47     bool replaceWithWildCard(std::vector<std::vector<std::string>::iterator>& cont,
48     std::vector<std::string>& sequence, std::vector<std::string>& result,
49     const std::string& wildCard = "X");
50     }
51 gezelter 1490 #endif
52 tim 1823

Properties

Name Value
svn:executable *