ALMA Computing Group
Classes | Modules | Functions

Client Examples
[ACS C++ Examples Documentation]

Collaboration diagram for Client Examples:

Classes

class  ClientErrorComponent
 This class demonstrates error handling when accessing a (remote) component. More...

Modules

 Async Calls
 

Description

This is is a client that uses asynchronous calls. It access a MOUNT component to move the antenna to a definite position. The movement is asynchronous

What can I gain from this example?

  • Simple client usage
  • asynchronous calls to read property
  • asynchronous execution of methods
  • Usage of baci threads

 Client
 

Description

Client is a pretty simple example of SimpleClient usage.  It logs into Manager and utilizes the ACS logging service to record all Mount components manager knows about.  Next, it gets a reference to one of those Mount instances (where the component's name is passed from the command-line).  From this reference, the actAz read-only double property is obtained asynchronously and it's value is logged.

What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • Using manager to dynamically determine what components are available.
  • ACS logging mechanisms.
  • Accessing (remote) components.
  • Invoking asynchronous methods using callbacks.


Links


 Client Alarm Thread
 

Description

This client creates a BACI alarm (basically using the callback pattern) on a read-only double BACI property. The values necessary for this alarm to "go off" are set using an ACS thread.

What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • ACS logging mechanisms.
  • Accessing (remote) components.
  • Creating alarms on remote objects
  • Creating ACS threads outside the context of components


Links


 Client AmsSeq
 

Description

This example shows a client that:
  • logs into manager
  • gets a reference to an Antenna Mount Sequence component specified from the command-line
  • takes a read-only double sequence property from the component and prints out its values
  • sets a read-write double sequence property and then invokes an IDL method
  • logs out of manager


What can I gain from this example?

  • SimpleClient usage.
  • Manipulation of BACI sequence properties.
  • ACS logging mechanisms.
  • Accessing (remote) components.


Links


 Client Dynamic Component
 

Description

This trivial client uses SimpleClient's manager reference to retrieve a dynamic component. In this case, it's a Hello World component.

What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • ACS logging mechanisms.
  • Accessing (dynamic) components through manager methods.


Links


 Client Error Component
 

Description

Client that uses the Error Component to catch exception/completion and manage them. This example shows a client that:
  • logs into manager via SimpleClient
  • activates the ErrorComponent component specified from the command-line
  • calls the methods in this component to show examples of error handling
  • releases the component
  • logs out of manager

Error handling examples are encapsulated in the ClientErrorComponent class. Each method in the class shows an example.

What can I gain from this example?

  • SimpleClient usage.
  • Dealing with errors accessing (remote) components.


Links


 Client Fridge
 

Description

This example shows a client that:
  • logs into manager
  • gets a fridge component specified from the command-line
  • retrieves the value of a BACI property synchronously
  • creates a monitor using the callback pattern for the property
  • releases the component
  • logs out of manager


What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • ACS logging mechanisms.
  • Accessing (remote) components.
  • Using callback classes for BACI monitors.


Links


 Client Fridge Commands
 

Description

This example shows a client that:
  • logs into manager
  • gets a fridge component specified from the command-line
  • invokes a command on the component specified from the command-line
  • releases the component
  • logs out of manager


What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • ACS logging mechanisms.
  • Accessing (remote) components.


Links


 Client Fridge Channel Event Consumer
 

Description

ClientFridgeNC provides developers with a very simple example on creating an event consumer for a given channel using the SimpleConsumer class.  In this particular example, only FRIDGE::temperatureDataBlockEvent events are processed (and only five are printed to standard out). After 50 seconds, the consumer disconnects from the channel.

What can I gain from this example?

  • The ability to process a certain type of event on a given notification channel without the need for subclassing.
  • Usage of the ACS_NEW_SIMPLE_CONSUMER macro which is mandatory for events defined in ICDs.
  • The implementation of a so-called "handler" function.


Links


 Client Hello World
 

Description

This example shows a client that:
  • logs into manager via SimpleClient
  • activates the HELLOWORLD component specified from the command-line
  • calls the displayMessage() method
  • releases the component
  • logs out of manager


What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • Accessing (remote) components.


Links


 Client List Components
 

Description

This example shows a client that:
  • logs into manager
  • gets information on all components
  • logs out of manager


What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • The knowledge that a manager reference can be used for more than just getting component references.
  • ACS logging mechanisms.


Links


 Client Wave
 

Description

This example shows a client that:
  • logs into manager
  • gets a MOUNT component
  • spawns a thread
  • calls the mount->objfix() command from within the thread setting the mount position in a sin() wave
  • gets callback replies
  • destroys the callback and releases the component
  • logs out of manager


What can I gain from this example?

  • SimpleClient usage.
  • Using manager directly through SimpleClient.
  • ACS logging mechanisms.
  • Accessing (remote) components.
  • Using callback classes for asynchronous methods.
  • ACS thread usage.


Links


Functions

 ClientErrorComponent::ClientErrorComponent (SimpleClient &client, char *errorComponent)
virtual ClientErrorComponent::~ClientErrorComponent ()
void ClientErrorComponent::TestOk ()
 Here everything should go fine.
void ClientErrorComponent::TestReceiveRemoteException ()
 Example 1: Calls a method that throws an exception with an error trace.
void ClientErrorComponent::testTypeException ()
 Example 4: Calls a method that throws an exception with an error trace.
void ClientErrorComponent::testExceptionFromCompletion ()
 Example 3: Calls a method that throws an exception with an error trace.
void ClientErrorComponent::TestReceiveRemoteCompletion ()
 Example 2: Calls a method that returns a completion If the completion contains an error, then.
void ClientErrorComponent::testCompletionOnStack ()
 Example 6: Calls a method that returns a completion created on the stack instead of heap If the completion contains an error, then.
void ClientErrorComponent::testCompletionFromCompletion ()
 Example 6: Calls a method that returns a completion If the completion contains an error, then.
void ClientErrorComponent::TestReceiveCorbaSystemException ()
 Example 5: Calls a method that throws a CORBA system exception It:
void ClientErrorComponent::testOutCompletion ()
 Example 7: Calls a method that returns a completion as an "out" parameter.

Function Documentation

ClientErrorComponent::ClientErrorComponent ( SimpleClient &  client,
char *  errorComponent 
) [inherited]
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 238 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::client_m, ClientErrorComponent::errorComponent_m, and ClientErrorComponent::foo_m.

void ClientErrorComponent::testCompletionFromCompletion (  )  [inherited]

Example 6: Calls a method that returns a completion If the completion contains an error, then.

  • Catches the exception,
  • prints it locally
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 674 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::testCompletionOnStack (  )  [inherited]

Example 6: Calls a method that returns a completion created on the stack instead of heap If the completion contains an error, then.

  • Catches the exception,
  • prints it locally
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 631 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::testExceptionFromCompletion (  )  [inherited]

Example 3: Calls a method that throws an exception with an error trace.

  • Catches the exception,
  • Adds context information
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 481 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::TestOk (  )  [inherited]

Here everything should go fine.

Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 283 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::testOutCompletion (  )  [inherited]

Example 7: Calls a method that returns a completion as an "out" parameter.

Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 768 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::TestReceiveCorbaSystemException (  )  [inherited]

Example 5: Calls a method that throws a CORBA system exception It:

  • Catches the exception,
  • prints it locally
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Todo:
Implement a real wrapper exception class, to make the conversion transparent

Definition at line 717 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::TestReceiveRemoteCompletion (  )  [inherited]

Example 2: Calls a method that returns a completion If the completion contains an error, then.

  • Catches the exception,
  • prints it locally
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 588 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::TestReceiveRemoteException (  )  [inherited]

Example 1: Calls a method that throws an exception with an error trace.

  • Catches the exception,
  • Adds context information
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 316 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

void ClientErrorComponent::testTypeException (  )  [inherited]

Example 4: Calls a method that throws an exception with an error trace.

  • Catches the exception,
  • Adds context information
  • sends it to the logging system
Exceptions:
ACSErrTypeCommon::CouldntAccessComponentExImpl 

Definition at line 375 of file acsexmplClientErrorComponent.cpp.

References ClientErrorComponent::foo_m.

ClientErrorComponent::~ClientErrorComponent (  )  [virtual, inherited]