SourceForge.net Logo
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

EkErrp Class Reference

Smart pointer class for EkError. More...

#include <EkError.h>

Collaboration diagram for EkErrp:

[legend]
List of all members.

Public Methods

 EkErrp ()
 EkErrp (const EkErrp &)
 EkErrp (EkError *)
 EkErrp (EkError &)
 ~EkErrp ()
EkErrp & operator= (const EkErrp &)
EkErrp & operator= (EkError *)
EkErroroperator-> () const
 operator EkError * () const
bool isNil () const
EkErrorgetp () const

Detailed Description

Smart pointer class for EkError.

With many different error classes based on EkError, it is tempting to use EkError* pointers as function return values and thrown exception values. A problem arises as to where the objects that such pointers refer to will be stored. If a function creates an error object in local memory, i.e. on the stack, it will no longer be valid after the function returns or after a thrown exception unrolls the stack. If the error object is in global (static) memory, then a subsequent call to the same function may overwrite a previous error. If the error objects are allocated on the heap, by "new", then somebody has to delete them. Failure to delete them results in memory leaks. Attempting to delete them more than once may lead to heap management problems. The goto-like behavior of exceptions can bypass "delete" statements in all but very carefully crafted code.

The smart pointer class, EkErrp, provides a "handle" to "carry around" EkError objects and objects of its derived types without knowing the exact type. An EkErrp can be copied, thrown as an exception or returned as the value of a function without loss of information.

EkErrp is a reference-counted smart pointer. When the last EkErrp that points to an error object is destroyed (either explicitly or by going out of scope) the error object is deleted.


Constructor & Destructor Documentation

EkErrp::EkErrp  
 

EkErrp::EkErrp const EkErrp &   
 

EkErrp::EkErrp EkError  
 

EkErrp::EkErrp EkError  
 

EkErrp::~EkErrp  
 


Member Function Documentation

EkError * EkErrp::getp   const
 

bool EkErrp::isNil   const
 

EkErrp::operator EkError *   const
 

EkError * EkErrp::operator->   const
 

EkErrp & EkErrp::operator= EkError  
 

EkErrp & EkErrp::operator= const EkErrp &   
 


The documentation for this class was generated from the following files:
Last Updated: March 12, 2003 (rlr)
Copyright © 2003 Eastman Kodak Company All Rights Reserved.