Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ErrorComponent Class Reference
[ACS Components Examples]

#include <acsexmplErrorComponentImpl.h>

Inheritance diagram for ErrorComponent:

Inheritance graph
[legend]
Collaboration diagram for ErrorComponent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ErrorComponent (const ACE_CString &name, maci::ContainerServices *containerServices)
virtual ~ErrorComponent ()
virtual void displayMessage ()
virtual void badMethod (CORBA::Short depth)
virtual void exceptionFromCompletion (CORBA::Short depth)
virtual void typeException (CORBA::Short depth)
virtual void corbaSystemException ()
virtual ACSErr::CompletioncompletionFromException (CORBA::Short depth)
virtual ACSErr::CompletioncompletionFromCompletion (CORBA::Short depth)
ACSErr::CompletioncompletionOnStack (CORBA::Short depth)
void outCompletion (ACSErr::Completion_out comp)

Private Member Functions

virtual ACSErr::CompletionImplcreateCompletion (unsigned short depth)
virtual void buildErrorTrace (unsigned short depth)

Detailed Description

This class shows how to deal with errors in components.

All components should inherit from CharacteristicComponentImpl or it's superclass, ACSComponentImpl, to remain compatiable with ACS tools such as objexp (i.e., a GUI used to manipulate components). This class also derives from POA_acsexmplErrorComponent::ErrorComponent which is a class automatically generated by CORBA from ErrorComponent's IDL file.

Version:
"@(#) $Id: acsexmplErrorComponentImpl.h,v 1.10 2008/10/09 08:41:11 cparedes Exp $"


Constructor & Destructor Documentation

ErrorComponent::ErrorComponent const ACE_CString &  name,
maci::ContainerServices containerServices
 

Constructor

Parameters:
poa Poa which will activate this and also all other components. Developers need not be concerned with what a PortableServer does...just pass it to the superclass's constructor.
name component's name. All components have a name associated with them so other components and clients can access them.

virtual ErrorComponent::~ErrorComponent  )  [virtual]
 

Destructor


Member Function Documentation

virtual void ErrorComponent::badMethod CORBA::Short  depth  )  [virtual]
 

Simple method raises a remote exception within the calling client. Implementation of IDL badMethod().

Parameters:
depth depth of the error trace
Exceptions:
ACSErrTypeCommon::GenericErrorEx 
ACSErrTypeCommon::UnexpectedExceptionEx 

virtual void ErrorComponent::buildErrorTrace unsigned short  depth  )  [private, virtual]
 

The aim of this method is to build an error trace. It builds the error trace using exception, but the same could be done using Completion. It simply throw an exception containing an error trace with the requested depth, if > 0 Otherwise just returns.

Notice that this method throws a LOCAL exception xxxExImpl and not a remote exception xxx

Parameters:
depth depth of the error trace
Exceptions:
ACSErrTypeCommon::GenericErrorExImpl 

virtual ACSErr::Completion* ErrorComponent::completionFromCompletion CORBA::Short  depth  )  [virtual]
 

Simple method that returns a REMOTE (CORBA) completion (ACSErr::Completion), where an error trace is added from a completion.

Parameters:
depth depth of the error trace, if <=0, returns OK completion
Returns:
ACSErr::Completion *

*

virtual ACSErr::Completion* ErrorComponent::completionFromException CORBA::Short  depth  )  [virtual]
 

Simple method that returns an ACSErr::Completion, where an error trace is added from an exception.

Parameters:
depth depth of the error trace, if <=0, returns OK completion
Returns:
ACSErr::Completion *

*

ACSErr::Completion* ErrorComponent::completionOnStack CORBA::Short  depth  ) 
 

This method is similar than completionFromCompletion, but it allocated C++ completion on the stack instead on the heap.

Parameters:
depth depth of the error trace, if <=0, returns OK completion
Returns:
ACSErr::Completion *

*

virtual void ErrorComponent::corbaSystemException  )  [virtual]
 

Method that throws a CORBA::BAD_PARAM system exception to show how to handle CORBA System Exceptions

virtual ACSErr::CompletionImpl* ErrorComponent::createCompletion unsigned short  depth  )  [private, virtual]
 

This method return a LOCAL (C++) completion which contains an error trace if depth > 0, otherwise it returns non error completion (ACSErrOKCompletion), i.e. completion w/o ane error trace

Parameters:
depth depth of the error trace

virtual void ErrorComponent::displayMessage  )  [virtual]
 

Displays "Hello World" to the console. Implementation of IDL displayMessage().


virtual void ErrorComponent::exceptionFromCompletion CORBA::Short  depth  )  [virtual]
 

Simple method raises a remote exception within the calling client. The error trace in the exception is added from a completion. Implementation of IDL method.

Parameters:
depth depth of the error trace
Exceptions:
ACSErrTypeCommon::GenericErrorEx 

void ErrorComponent::outCompletion ACSErr::Completion_out  comp  ) 
 

Simple method that returns an ACSErr::Completion as an out parameter

Parameters:
comp Completion as out parameter *

*

virtual void ErrorComponent::typeException CORBA::Short  depth  )  [virtual]
 

This method throws a REMOTE (CORBA) type exception if depth>0. If we want to throw a type exception we have to specfy this in the method signature. In this example the method can throw: ACSErrTypeCommon::GenericErrorEx or ACSErrTypeCommon::ACSErrTypeCommonEx exceptions. Although GenericErrorEx derives from ACSErrTypeCommonEx we have to specfy both in the method signature because IDL does not support hierarchy of exceptions.

Parameters:
depth depth of the error trace
Exceptions:
ACSErrTypeCommon::GenericErrorEx 
ACSErrTypeCommon::ACSErrTypeCommonEx 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:36:25 2009 for ACS C++ API by doxygen 1.3.8