namespace policy_utils

Some generic utility functions used by different policy components. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Types

Public Methods


Detailed Description

Some generic utility functions used by different policy components.

PolicyUtilsErr (class)

PolicyUtilsErr

template <class T> void  delete_vector (vector<T*>* v)

delete_vector

Deletes a vector by deleting objects and deleting the vector itself. It checks if objects are null and skips them if so. Also checks if vector itself is null.

Parameters:

vvector to delete
template <class T> void  clear_container (T& l)

clear_container

Deletes objects in container. Checks if objects are null and skips them if so.

The container is cleared at the end.

Parameters:

lcontainer to be deleted and cleared.
template <class A, class T> void  clear_map (map<A,T*>& m)

clear_map

Delets objects of a map and clears the map at the end. Checks for null objects.

Parameters:

mmap to be deleted and cleared.
template <class T> void  clear_map_container (T& m)

clear_map_container

Delets objects of a map-like container and clears the map at the end. Checks for null objects.

Parameters:

mmap-like container to be deleted and cleared.
void  str_to_list (const string& in, list<string>& out)

str_to_list

Converts a string in the form "1,2,...,n" to a list of strings.

Parameters:

ininput string.
outoutput list.
void  str_to_set (const string& in, set<string>& out)

str_to_set

Converts a string in the form "1,2,...,n" to a set of strings.

Parameters:

ininput string.
outoutput set.
template <class T> string  to_str (T x)

to_str

Converts an object to a string via an ostringstream.

Parameters:

xobject to convert to string.

Returns: string representation of object.

void  read_file (const string& fname, string& out)

read_file

Reads a file into a string. An exception is thrown on error.

Parameters:

fnamefilename to read.
outoutput string which will be filled with file content.
unsigned  count_nl (const char* x)

count_nl

Count the occurences of newlines in the c-style string.

Parameters:

xthe 0 terminated c-style string to count new lines in.

Returns: the number of new lines in the string.

bool  regex (const string& str, const string& reg)

regex

Match a regex.

Parameters:

strinput string to check.
regregular expression used for matching.

Returns: true if string matches regular expression


Generated by: pavlin on possum.icir.org on Thu Mar 9 04:43:23 2006, using kdoc $.