error_vector_t Class Reference

The main class in error.hh determined for storing. More...

#include <error.hh>

List of all members.

Public Member Functions

void clear ()
 Removes all error messages from a memory.
ERR_nbr_t count ()
 Returns a number of error messages in the vector.
bool empty ()
 Returns whether there exists any error message in a memory.
 error_vector_t ()
 A constructor.
void flush ()
 Flushes all stored error messages.
bool get_silent () const
 Returns, whether it can write messages to STDERR (true) or not (false).
ERR_id_t id (const ERR_nbr_t i)
ERR_id_t id_back ()
 Returns error ID of the error message from the end of the list of errors.
ERR_id_t id_front ()
error_vector_toperator<< (const int i)
error_vector_toperator<< (const unsigned int i)
error_vector_toperator<< (const signed long int i)
error_vector_toperator<< (const unsigned long int i)
error_vector_toperator<< (const error_string_t second_str)
 Appends second_str to the error message creating in the error vector.
error_vector_toperator<< (const ERR_std_string_t &second_str)
 Appends second_str to the error message creating in the error vector.
error_vector_toperator<< (const ERR_char_string_t second_str)
 Appends second_str to the error message creating in the error vector.
void operator<< (const psh &e)
 Finishes creating of an error message and calls 'warning handling callback'.
void operator<< (const thr &e)
 Finishes creating of an error message and calls 'error handling callback'.
void perror (ERR_char_string_t mes, const ERR_nbr_t i)
void perror (const ERR_nbr_t i)
void perror_back (ERR_char_string_t mes)
void perror_back ()
void perror_front (ERR_char_string_t mes)
void perror_front ()
void pop (const ERR_nbr_t begin, const ERR_nbr_t end)
 Removes interval of errors.
void pop (const ERR_nbr_t index)
 Removes `index'-th error.
void pop_back ()
 Removes 1 error message from the end of the list of errors.
void pop_back (const ERR_nbr_t n)
 Removes last n errors.
void pop_front ()
 Removes 1 error message from the beginning of the list of errors.
void pop_front (const ERR_nbr_t n)
 Removes first n errors.
void print (ERR_char_string_t mes)
 Prints mes to the standard error output.
void push (error_string_t &mes, const ERR_id_t id=ERR_UNKNOWN_ID)
 Inserts an error message to the end of a list of errors.
void set_push_callback (const ERR_psh_callback_t func)
 Sets a 'warning handling callback'.
void set_silent (const bool be_silent)
 Sets, whether it can write messages to STDERR (true) or not (false).
void set_throw_callback (const ERR_thr_callback_t func)
 Sets a 'error handling callback'.
const error_string_t string (const ERR_nbr_t i)
const error_string_t string_back ()
 Returns the string of the error message from the end of the list of errors.
const error_string_t string_front ()
void that (error_string_t &mes, const ERR_type_t err_type=ERR_UNKNOWN_TYPE, const ERR_id_t id=ERR_UNKNOWN_ID)
 Serves to store standardized error messages given by elements.
void that (const ERR_c_triplet_t &st)
 ~error_vector_t ()
 A destructor.


Detailed Description

The main class in error.hh determined for storing.

This is the main class in error.hh. It is determined to store and handle all errors and warnings in your program. It is a replacement of standard error handling through throw & catch statements, but it defaultly uses throw & catch constructs to jump out of the problematic piece of a program code (that caused a possible error).

The main advantage of this class is a user friendly interface formed especially by `<<' operators, which permits to work with error_vector_t similarly as with ostream class.

The another advantage and the reason why this is a vector instead of single error buffer is that we distinguish between non-fatal errors (we call them 'warnings') and fatal errors (we call them 'errors').

The behaviour in a case of storing of error or warning can be selected or changed by functions set_push_callback() and set_throw_callback().

For more informations about usage see Error Handling Unit.


Constructor & Destructor Documentation

error_vector_t (  )  [inline]

A constructor.

Only initializes callback functions serving creation of error messages private attributes throw_callback and push_callback.

~error_vector_t (  )  [inline]

A destructor.

Only do some deallocation of dynamically allocated memory (in instances of error_string_t)

References ERR_UNKNOWN_ID, and ERR_UNKNOWN_TYPE.


Member Function Documentation

void flush (  ) 

Flushes all stored error messages.

Prints all error messages stored in a memory to the standard error output and calls clear() to empty the memory.

References clear(), count(), and perror().

Referenced by ERR_default_thr_callback().

ERR_id_t id ( const ERR_nbr_t  i  ) 

Returns error ID of i-th error message from the beginning of the list of errors

ERR_id_t id_front (  ) 

Returns error ID of the error message from the beginning of the list of errors

error_vector_t& operator<< ( const int  i  )  [inline]

Appends string representing i to the error message creating in the error vector

error_vector_t& operator<< ( const unsigned int  i  )  [inline]

Appends string representing i to the error message creating in the error vector

error_vector_t& operator<< ( const signed long int  i  )  [inline]

Appends string representing i to the error message creating in the error vector

error_vector_t& operator<< ( const unsigned long int  i  )  [inline]

Appends string representing i to the error message creating in the error vector

void operator<< ( const psh e  ) 

Finishes creating of an error message and calls 'warning handling callback'.

Finishes creating of an error message and inserts prepared error message to the end of the list of errors. Then calls 'warning handling callback' (see ERR_psh_callback_t)

References psh::c, push(), and psh::t.

void operator<< ( const thr e  ) 

Finishes creating of an error message and calls 'error handling callback'.

Finishes creating of an error message and inserts prepared error message to the end of the list of errors. Then calls 'error handling callback' (see ERR_thr_callback_t)

References thr::c, thr::t, and that().

void perror ( ERR_char_string_t  mes,
const ERR_nbr_t  i 
)

Prints mes and i-th message (from the beginning of the list of errors) to the standard error output

void perror ( const ERR_nbr_t  i  ) 

Prints i-th message (from the beginning of the list of errors) to the standard error output

Referenced by flush(), por_t::generate_ample_sets(), and por_t::generate_composed_ample_sets().

void perror_back ( ERR_char_string_t  mes  ) 

Prints mes and the first message from the end of the list of errors to the standard error output

void perror_back (  ) 

Prints the first message from the end of the list of errors to the standard error output

Referenced by ERR_default_psh_callback().

void perror_front ( ERR_char_string_t  mes  ) 

Prints mes and the first message from the beginning of the list of errors to the standard error output

void perror_front (  ) 

Prints the first message from the beginning of the list of errors to the standard error output

void pop ( const ERR_nbr_t  begin,
const ERR_nbr_t  end 
)

Removes interval of errors.

Removes all error messages with ordering number from begin (inclusive) to end (exclusive) in a list of errors.

void pop ( const ERR_nbr_t  index  ) 

Removes `index'-th error.

Removes index-th error message from the beginning of the list of errors

void pop_back ( const ERR_nbr_t  n  ) 

Removes last n errors.

Removes n error messages from the end of the list of errors. If n = 0, then removes all errors from a memory.

References pop_back().

Referenced by ERR_default_psh_callback().

void pop_front ( const ERR_nbr_t  n  ) 

Removes first n errors.

Removes n error messages from the begining of the list of errors. If n = 0, then removes all errors from a memory.

References pop_front().

void push ( error_string_t mes,
const ERR_id_t  id = ERR_UNKNOWN_ID 
)

Inserts an error message to the end of a list of errors.

Inserts an error message to the end of a list of errors. It does not call any of callback functions (= any of warning/error handling callbacks).

Note: parameter id is optional.

References error_string_t::recreate().

Referenced by operator<<(), and that().

const error_string_t string ( const ERR_nbr_t  i  ) 

Returns the string of i-th error message from the beginning of the list of errors

const error_string_t string_front (  ) 

Returns the string of the error message from the beginning of the list of errors

void that ( error_string_t mes,
const ERR_type_t  err_type = ERR_UNKNOWN_TYPE,
const ERR_id_t  id = ERR_UNKNOWN_ID 
)

Serves to store standardized error messages given by elements.

 terr.that(message, id, type)
is functionally equivalent to
 terr << message << thr(type, id) 
Note: Parameters err_type and id are not obligatory.

References push().

void that ( const ERR_c_triplet_t st  ) 

Serves to store standardized error messages (in triplets ERR_triplet_t).

 terr.that(triplet)
is functionally equivalent to
 terr << triplet.message << thr(triplet.type, triplet.id) 

References error_string_t::delete_content(), ERR_triplet_t::id, ERR_triplet_t::message, push(), and ERR_triplet_t::type.

Referenced by operator<<().


The documentation for this class was generated from the following files:

Reference Manual for Library, 2006 developed in ParaDiSe laboratory, Faculty of Informatics, Masaryk University