My Project
Typedefs | Functions
MyTools.h File Reference

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

lui

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:
argcnumber of elements in input
inputarray of strings to parse for flags and arguments
Returns:
A map related each flag to its given string value.
int lineCount ( string  filename)

Count the number of lines in a given file

Parameters:
filenameFile to count lines of
bool openFile ( ifstream *  fin,
string  filename 
)

Open an ifstream with some basic checks

Parameters:
finifstream to use to open file
filenamefile 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:
pStringString to trim
pWhitespaceCharacters 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:
IDsmap to output
fileOutFile to print results to
 All Classes Files Functions Variables Typedefs