nmn::SearchIssue< Element > Class Template Reference

Encapsulate a search result. More...

#include <searchissue.h>

List of all members.

Public Member Functions

 SearchIssue (bool found)
 Constructor.
 SearchIssue (bool found, Element &element)
 Constructor.
 ~SearchIssue ()
 Destructor.
bool found () const
 Returns true if the search succeeded, false otherwise.
Element & get ()
 Returns the element was taken if the search succeded.

Static Public Attributes

static Element _empty_element = Element( )

Private Attributes

bool _found
Element & _element


Detailed Description

template<typename Element>
class nmn::SearchIssue< Element >

Encapsulate a search result.

The result for a search can be described by two states: the search succeded or fails; if it succeeded the element that was found could be taken. This class summarizes this concept.


Constructor & Destructor Documentation

template<typename Element>
nmn::SearchIssue< Element >::SearchIssue ( bool  found  ) 

Constructor.

Parameters:
found true if the search succeeded, false otherwise.
By this constructor it is possible to specify if the search was fail or not, but no element is taken. Anyway the usual use of this constructor is when the search fails, in very special cases is useful to search something without take it.

template<typename Element>
nmn::SearchIssue< Element >::SearchIssue ( bool  found,
Element &  element 
)

Constructor.

Parameters:
found true if the search succeeded, false otherwise.
element the elemet took if the search succeeded.
By this constructor it is possible to specify if the search was fail or not, if it succeded the element was the result of the search is taken. The usual use of this constructor is when the search succeded.

template<typename Element>
nmn::SearchIssue< Element >::~SearchIssue (  ) 

Destructor.


Member Function Documentation

template<typename Element>
bool nmn::SearchIssue< Element >::found (  )  const

Returns true if the search succeeded, false otherwise.

When the SearchIssue object was created, the constructor always accept a boolean parameter that values true if the search succeeded, false otherwise. This method return that value.

template<typename Element>
Element & nmn::SearchIssue< Element >::get (  ) 

Returns the element was taken if the search succeded.

If the search succeeded the element was found is returned, otherwise a default static empty element is returned.


Member Data Documentation

template<typename Element>
Element& nmn::SearchIssue< Element >::_element [private]

template<typename Element>
Element nmn::SearchIssue< Element >::_empty_element = Element( ) [static]

template<typename Element>
bool nmn::SearchIssue< Element >::_found [private]


The documentation for this class was generated from the following files:
Generated on Sun Nov 18 21:29:41 2007 for nmnurbs by  doxygen 1.4.7