Declarations of helper functions.
More...
#include <cstdlib>
#include <vector>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
#include "boost/tuple/tuple.hpp"
#include "boost/tuple/tuple_comparison.hpp"
#include "boost/tuple/tuple_io.hpp"
#include "boost/algorithm/string.hpp"
#include "boost/lexical_cast.hpp"
Go to the source code of this file.
Typedefs |
typedef long unsigned int | lui |
typedef short unsigned int | sui |
Functions |
bool | openFile (ifstream *fin, string filename) |
const std::string | trim (const std::string &pString, const std::string &pWhitespace=" \n\r") |
bool | fline_tr (ifstream *fin, vector< string > *fields, string delim=" ") |
map< string, vector< string > > | getParameters (int argc, char **input) |
int | lineCount (string filename) |
template<typename T , typename R > |
void | WriteMap (map< T, R > *IDs, string fileOut) |
Detailed Description
Declarations of helper functions.
- See also:
- MyTools.cc for explanations
Typedef Documentation
Get used to seeing this one everywhere. The others, not so much.
Function Documentation
map< string, vector < string > > getParameters |
( |
int |
argc, |
|
|
char ** |
input |
|
) |
| |
Return a list of parameter names and values from a string. The names can be preceeded by nothing, a '-' or a '--'. The value then follows an '='. Values that may contain nested flags should be surrounded by single quotes (').
- Parameters:
-
argc | number of elements in input |
input | array of strings to parse for flags and arguments |
- Returns:
- A map related each flag to its given string value.
Count the number of lines in a given file
- Parameters:
-
filename | File to count lines of |
bool openFile |
( |
ifstream * |
fin, |
|
|
string |
filename |
|
) |
| |
Open an ifstream with some basic checks
- Parameters:
-
fin | ifstream to use to open file |
filename | file to open |
- Returns:
- if open successful
const std::string trim |
( |
const std::string & |
pString, |
|
|
const std::string & |
pWhitespace |
|
) |
| |
Remove beginning and trailing "whitespace" from the string
- Parameters:
-
pString | String to trim |
pWhitespace | Characters to trim at the ends of the given strings. |
- Returns:
- string with whitespace characters stripped from beginning and end
template<typename T , typename R >
void WriteMap |
( |
map< T, R > * |
IDs, |
|
|
string |
fileOut |
|
) |
| |
Writes a map to a file
- Parameters:
-
IDs | map to output |
fileOut | File to print results to |