Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes

ACSError Class Reference

#include <acserrLegacy.h>

List of all members.

Public Member Functions

 ACSError ()
 ACSError (const char *file, int line)
 ACSError (const char *file, int line, const char *routine)
 ACSError (const ACSErr::ErrorTrace &errortrace)
 ACSError (ACSErr::ErrorTrace &errortrace)
 ACSError (const char *file, int line, ACSErr::ErrorTrace *errortrace, bool release=1)
 ACSError (ACSErr::ErrorTrace *errortrace, bool release=1)
 ACSError (const char *file, int line, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY)
 ACSError (const char *file, int line, ACSError &err, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY)
 ACSError (const char *file, int line, ACSError *err, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY, bool release=1)
 ACSError (ACSErr::ACSException &exception)
 ACSError (const char *file, int line, ACSErr::ACSException &pex, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY)
 ACSError (const char *file, int line, ACSErr::ErrorTrace &pc, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY)
 ~ACSError ()
ACSErr::ErrorTrace & getErrorTrace ()
ACSErr::ErrorTrace * returnErrorTrace (bool deletion=true)
ACSErr::ErrorTrace * getNext ()
ACSErr::ErrorTrace * top ()
void log ()
bool isOK ()
void addData (const char *name, const char *value)
template<class T >
void addData (const char *name, T value)
char * getDescription ()
char * getFileName ()
CORBA::ULong getLineNumber ()
char * getRoutine ()
char * getHostName ()
char * getProcess ()
char * getThread ()
CORBA::ULongLong getTimeStamp ()
ACSErr::ErrorCode getErrorCode ()
ACSErr::ACSErrType getErrorType ()
ACSErr::Severity getSeverity ()
unsigned int getDepth ()
void setTimeStamp (CORBA::ULongLong time)
void setFileName (const char *fn)
void setLineNumber (CORBA::ULong ln)
void setError (ACSErr::ACSErrType ty, ACSErr::ErrorCode ec)
void setSeverity (ACSErr::Severity severity)

Static Public Member Functions

static char * getDescription (ACSErr::ACSErrType et, ACSErr::ErrorCode ec)
static void hostName (const char *hn)
static void processName (const char *pn)
static void setProcessName (const char *pn)
static ACSErr::ErrorTrace createErrorTrace (const char *file, int line, ACSError &er)
static ACSErr::ErrorTrace createErrorTrace (const char *file, int line, ACSErr::ACSException &pex, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY)
static ACSErr::ErrorTrace createErrorTrace (const char *file, int line, ACSErr::ACSErrType et, ACSErr::ErrorCode ec, const char *routine, ACSErr::Severity severity=DEFAULT_SEVERITY)
static bool init (int argc, char *argv[])
static bool init (CORBA::ORB_ptr _orb)
static bool init ()
static bool isInit ()
static void done ()

Protected Member Functions

void log (ACSErr::ErrorTrace *c, int level)
void fill (ACSErr::ACSErrType et, ACSErr::ErrorCode ec, ACSErr::Severity severity, const char *file, int line, const char *routine)
ACS::Time getTime ()

Static Protected Member Functions

static bool initLog (CORBA::ORB_ptr _orb)

Protected Attributes

ACSErr::ErrorTrace errorTrace
ACSErr::ErrorTrace * current
unsigned int depth

Static Protected Attributes

static bool initialized
static CORBA::ORB_var orb
static std::unexpected_handler m_oldUnexpected
static std::terminate_handler m_oldTerminate
static const ACSErr::ACSErrType ACSErrTypeOK
static const ACSErr::ErrorCode ACSErrOK

Detailed Description

Helper class for handling error structure (=ErrorTrace) locally in C++.


Constructor & Destructor Documentation

ACSError::ACSError (  ) 

Constructor for creating "no error" object which does not contain runtime and source information. Instead can be used macro ACS_ERROR(). It just set error code and type to 0 (e.g. ACSErrOK, ACSErrTypeOK).

Todo:
in case of error exception shall be thrown
ACSError::ACSError ( const char *  file,
int  line 
)

Constructor for creating "no error" object which does not contain runtime and source information. Instead can be used macro ACS_ERROR(). It just set error code and type to 0 (e.g. ACSErrOK, ACSErrTypeOK). This constructor is functional equal to constructor ACSError () and it is there just that macro ACS_ERROR () can be used.

Parameters:
file it is ignored
line it is ignored
ACSError::ACSError ( const char *  file,
int  line,
const char *  routine 
)

Constructor for creating "no error" object. Instead can be used macro ACS_ERROR(ro).

Parameters:
file name of the file where the error occured (should be used __FILE__ macro)
line line number where the error occured (should be used __LINE__ macro)
routine name of the routine where the error occured
ACSError::ACSError ( const ACSErr::ErrorTrace &  errortrace  ) 

Constructor for creating error object from errortrace.

Parameters:
errortrace structure contains error information
ACSError::ACSError ( ACSErr::ErrorTrace &  errortrace  ) 

Constructor for creating error object from errortrace.

Parameters:
errortrace structure contains error information
ACSError::ACSError ( const char *  file,
int  line,
ACSErr::ErrorTrace *  errortrace,
bool  release = 1 
)

Constructor for creating error object from pointer errortrace. It makes copy of errortrace.

Parameters:
file it is ignored
line it is ignored
pointer to errortrace structure contains error information
flag which indicates if errortrace shall be released - ACSError will take care of memory managment of the errortrace. This constructor is functional equal to constructor ACSError (ACSErr::ErrorTrace* errortrace, bool release=1) and it is there just that macro ACS_ERROR () can be used.
ACSError::ACSError ( ACSErr::ErrorTrace *  errortrace,
bool  release = 1 
)

Constructor for creating error object from pointer errortrace. It makes copy of errortrace.

Parameters:
pointer to errortrace structure contains error information
flag which indicates if errortrace shall be released - ACSError will take care of memory managment of the errortrace.
ACSError::ACSError ( const char *  file,
int  line,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY 
)

Constructor for creating error object. Macro ACS_ERROR(et, ec, ro) should be used instead.

Parameters:
file name of the file where the error occured (should be used __FILE__ macro)
line line number where error the occured (should be used __LINE__ macro)
et error type (group)
ec error code
routine name of the routine where the error occured
severity severity of error (default medium = DEFAULT_SEVERITY)
ACSError::ACSError ( const char *  file,
int  line,
ACSError err,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY 
)

Constructor for creating error object which contains also trace to previous error(s). Macro ACS_ERROR(perr, et, ec, ro) should be used instead.

Parameters:
file name of the file where the error occured (should be used __FILE__ macro)
line line number where error the occured (should be used __LINE__ macro)
err previos error
et error type (group)
ec error code
routine name of the routine where the error occured
severity severity of error (default medium = DEFAULT_SEVERITY)
release 
ACSError::ACSError ( const char *  file,
int  line,
ACSError err,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY,
bool  release = 1 
)

Constructor for creating error object which contains also trace to previous error(s). Macro ACS_ERROR(perr, et, ec, ro) should be used instead.

Parameters:
file name of the file where the error occured (should be used __FILE__ macro)
line line number where error the occured (should be used __LINE__ macro)
err previos error
et error type (group)
ec error code
routine name of the routine where the error occured
severity severity of error (default medium = DEFAULT_SEVERITY)
release 
ACSError::ACSError ( ACSErr::ACSException &  exception  ) 

Constructor for creating error object from IDL exception (=ACSException).

Parameters:
reference to the exception object contains error information i.e. ErrorTrace
ACSError::ACSError ( const char *  file,
int  line,
ACSErr::ACSException &  pex,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY 
)

Constructor for creating error object which contains also trace to previous error(s) from ACSException object. Macro ACS_ERROR(pe, ed, en, ro) should be used instead.

Parameters:
file name of the file where the error occured (should be used __FILE__ macro)
line line number where error the occured (should be used __LINE__ macro)
pex reference to previos exception
et error type
ec error code
routine name of the routine where the error occured
severity severity of error (default medium = DEFAULT_SEVERITY)
ACSError::ACSError ( const char *  file,
int  line,
ACSErr::ErrorTrace &  pc,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY 
)

Constructor for creating error object which contains also trace to previous error(s) from errortrace structure (ErrorTrace). Macro ACS_ERROR(pe, ed, en, ro) should be used instead.

Parameters:
file name of the file where the error occured (should be used __FILE__ macro)
line line number where error the occured (should be used __LINE__ macro)
pc reference to previos error contained in structure ErrorTrace
et error type (group)
ec error code
routine name of the routine where the error occured
severity severity of error (default medium = DEFAULT_SEVERITY)
ACSError::~ACSError (  ) 

Destructor


Member Function Documentation

void ACSError::addData ( const char *  name,
const char *  value 
)

Adds data to the current error

Parameters:
name data name
value string data value

Referenced by addData().

template<class T >
void ACSError::addData ( const char *  name,
value 
) [inline]

Adds data (pair of name-value)

Parameters:
name data name
value data value

References addData().

static ACSErr::ErrorTrace ACSError::createErrorTrace ( const char *  file,
int  line,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY 
) [static]
static ACSErr::ErrorTrace ACSError::createErrorTrace ( const char *  file,
int  line,
ACSError er 
) [inline, static]

References getErrorTrace().

static ACSErr::ErrorTrace ACSError::createErrorTrace ( const char *  file,
int  line,
ACSErr::ACSException &  pex,
ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
const char *  routine,
ACSErr::Severity  severity = DEFAULT_SEVERITY 
) [static]
static void ACSError::done (  )  [static]
void ACSError::fill ( ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec,
ACSErr::Severity  severity,
const char *  file,
int  line,
const char *  routine 
) [protected]

Fills errortrace structure

Parameters:
et error type (group)
ec error code
severity severity of error
file name of the file where the error occured
line line number where the error occured
routine name of the routine where the error occured
unsigned int ACSError::getDepth (  )  [inline]

Returns depth of error stack

Returns:
unsigned int depth

References depth.

char* ACSError::getDescription (  ) 

Returns copy of description of current error. User have to take care of releasing it!

Returns:
pointer to the char (=string)
static char* ACSError::getDescription ( ACSErr::ACSErrType  et,
ACSErr::ErrorCode  ec 
) [static]

Returns description of the error

Parameters:
et error type (group)
ec error code
ACSErr::ErrorCode ACSError::getErrorCode (  )  [inline]

Returns error code

Returns:
ACSErr::ErrorCode

References current.

ACSErr::ErrorTrace& ACSError::getErrorTrace (  )  [inline]

Gets reference to errortrace structure. User must take care for makeing copy of structure or should use method returnErrorTrace

Returns:
reference to the current errortrace structure
Todo:
if current is NULL than exception should be thrown

References current.

Referenced by createErrorTrace().

ACSErr::ACSErrType ACSError::getErrorType (  )  [inline]

Returns error type

Returns:
ACSErr::ACSErrType

References current.

char* ACSError::getFileName (  )  [inline]

Returns file name information of the error

Returns:
pointer to char contains file name

References current.

char* ACSError::getHostName (  )  [inline]

Returns host name information of the error

Returns:
pointer to char contains host name

References current.

CORBA::ULong ACSError::getLineNumber (  )  [inline]

Returns line number information of the error

Returns:
CORBA::ULong line number

References current.

ACSErr::ErrorTrace* ACSError::getNext (  ) 

Moves to the next errortrace element and return its pointer (not copy). If there is no next errortrace element NULL will be returned

Returns:
pointer to the errortrace structure
char* ACSError::getProcess (  )  [inline]

Retruns process information of the error. Its name or process ID.

Returns:
pointer to the char points to the copy of process information

References current.

char* ACSError::getRoutine (  )  [inline]

Returns routine information of tehe error

Returns:
pointer to char contains routine name

References current.

ACSErr::Severity ACSError::getSeverity (  )  [inline]

Returns error severity

References current.

char* ACSError::getThread (  )  [inline]

Returns thread information of the error. The name of thread or its ID.

Returns:
pointer to the char points to the copy of thread information

References current.

ACS::Time ACSError::getTime (  )  [protected]

Returns time in 100th of nano seconds needed for error time stamp

Returns:
time stamp in CORBA::ULongLong (64 bits)
CORBA::ULongLong ACSError::getTimeStamp (  )  [inline]

Returns time stamp of the error in 100th of nanoseconds.

Returns:
CORBA::ULongLong time stamp

References current.

static void ACSError::hostName ( const char *  hn  )  [static]

Sets host name

Parameters:
hn host name
static bool ACSError::init ( int  argc,
char *  argv[] 
) [static]
static bool ACSError::init (  )  [static]
static bool ACSError::init ( CORBA::ORB_ptr  _orb  )  [static]
static bool ACSError::initLog ( CORBA::ORB_ptr  _orb  )  [static, protected]
static bool ACSError::isInit (  )  [inline, static]

References initialized.

bool ACSError::isOK (  )  [inline]

Returns true if errortrace does not represent error otherwise false.

Returns:
boolean flag

References ACSErrOK, ACSErrTypeOK, and current.

void ACSError::log (  ) 

Logs errortrace information into logging system

void ACSError::log ( ACSErr::ErrorTrace *  c,
int  level 
) [protected]

Logs single error

Parameters:
c errortrace contains error to log
level of error in erro stack
static void ACSError::processName ( const char *  pn  )  [static]
Deprecated:
Sets process name
Parameters:
process name
ACSErr::ErrorTrace* ACSError::returnErrorTrace ( bool  deletion = true  ) 

Returns copy of errortrace structure (and delete ACSError object)

Parameters:
deletion flag indicates if ACSError has to be deleted. Default value is true what means that ACSError object will be deleted.
Returns:
pointer to the errortrace structure
void ACSError::setError ( ACSErr::ACSErrType  ty,
ACSErr::ErrorCode  ec 
) [inline]

Sets current error code

Parameters:
ty error type (should be of type ACSErr::ACSErrType defined in acserrType.idl)
ec erro code

References current.

void ACSError::setFileName ( const char *  fn  )  [inline]

Sets file name

Parameters:
fn file name

References current.

void ACSError::setLineNumber ( CORBA::ULong  ln  )  [inline]

Sets line number

Parameters:
ln line number

References current.

static void ACSError::setProcessName ( const char *  pn  )  [static]

Sets process name

Parameters:
process name
void ACSError::setSeverity ( ACSErr::Severity  severity  )  [inline]

Sets error severity

Parameters:
 severity errro severity

References current.

void ACSError::setTimeStamp ( CORBA::ULongLong  time  )  [inline]

Sets time stamp of the error in 100th of nanoseconds. time CORBA::ULongLong time stamp

References current.

ACSErr::ErrorTrace* ACSError::top (  )  [inline]

Moves to the first (top) errortrace element and return its pointer (not copy).

Returns:
pointer to the errortrace structure

References current, and errorTrace.


Member Data Documentation

const ACSErr::ErrorCode ACSError::ACSErrOK [static, protected]

Referenced by isOK().

const ACSErr::ACSErrType ACSError::ACSErrTypeOK [static, protected]

Referenced by isOK().

ACSErr::ErrorTrace * ACSError::current [protected]
unsigned int ACSError::depth [protected]

Referenced by getDepth().

ACSErr::ErrorTrace ACSError::errorTrace [protected]

Referenced by top().

bool ACSError::initialized [static, protected]

Referenced by isInit().

std::terminate_handler ACSError::m_oldTerminate [static, protected]
std::unexpected_handler ACSError::m_oldUnexpected [static, protected]
CORBA::ORB_var ACSError::orb [static, protected]

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