ALMA Computing Group
Modules

ACS C++ Examples Documentation

More...

Collaboration diagram for ACS C++ Examples Documentation:

Modules

 ACS Components Examples
 
 Building
 

Description

The purpose of Building is to show the implementation of hierarchical devices.  Building provides two synchronous methods, openFrontDoor() and closeFrontDoor().  These methods use the container to activate a Door object and then perform actions on that object.  Building also has one property, version, which is just the version of the C++ Building implementation currently used.

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • overriding component lifecycle methods (see execute).
  • the knowledge of how to create heirarchial devices.
  • how to use the container services to activate other components.
  • writing values to read-only BACI properties by using the property's underlying DevIO instance.
  • standard ACS logging macros.
  • limited CORBA error handling.
  • limited CORBA exception handling.
  • ,li>how to use the SmartPropertyPointer for a property


Links



 Calendar
 

Description

Calendar shows the proper usage of enumerated and pattern properties.  It provides two read-write enums, one read-only enum, and a read-write pattern.  There are no methods so this component should only be used through objexp (e.g., a graphical user interface designed specifically for manipulating components).

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • usage of enums properties via the ACS enum template.
  • usage of RW pattern properties.


Links


 BACI Callback and Alarm Implementation
 

Description

This header defines a number of BACI callback and alarm implementation classes that are used throughout the clients of the acsexmpl module. Any developer interested in invoking asynchronous methods or creating monitors should definitely review this section.

What can I gain from this example?

  • implementations of CORBA servants derived from the OffShoot IDL interface.
  • implementations of callbacks used to invoke asynchronous methods (e.g., MyCBvoid).
  • implementations of callbacks used to obtain the value of a BACI property asynchronously (e.g., MyCBdouble).
  • implementations of callbacks used to monitor the value of a BACI property (e.g., MyCBdouble).
  • implementations of alarms set to go off when a BACI property's value goes out of range (e.g., MyAlarmdouble).


Links




 Construction Error Hello World
 

Description

This simple Hello World component within the acsexmpl module provides an example component which is throwing an exception during its construction. This component can be used to test the behaviour of the maciContainer when a a component throws an exception in the constructor.

What can I gain from this example?

  • an example derived from the ACS::ACSComponent IDL interface.
  • an introduction to the ACS API.
  • limited ACS logging macros.
  • throwing exceptions.
  • Usage of ACS errors.


Links


 Door
 

Description

Door, as defined by the IDL interface, is another simple example of a component like Lamp except that it also contains one synchronous method, move(...).  The two asynchronous methods are open() and close() respectively.  This example has four properties and uses an ACS thread.

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • overriding component lifecycle methods (see execute).
  • asynchronous method implementation accomplished by inheriting methods from the ActionImplementator class.
  • read-only and read-write property usage.
  • writing values to read-only BACI properties by using the property's underlying DevIO instance.
  • limited exception handling.
  • extensive CORBA error handling.
  • thread management using ACS.
  • standard ACS logging macros.
  • very simple example of a state machine (i.e., the Door's positions).


Links


 Error Component
 

Description

Simple Component that throws few exceptions and completions to show the use. It shows how to the members can be set, when the exception/completion has one. Also shows the use of the wrappers of exception/completions and how transform them to corba structures to be catch by the client.

What can I gain from this example?

  • an example derived from the ACS::ACSComponent IDL interface.
  • use of ACS Exceptions
  • use of ACS Completions
  • raising CORBA exceptions.


Links


 Filter Wheel
 

Description

The class FilterWheel is a very simple example of a component that simulates the behavior of a generic filter wheel.  
The description of the wheel is on the CDB using the format dictated by the schema definition. It has one asynchronous method: moveFilterInBeam(...) that rotates the wheel to put selected filter in the beam. The adjust method moves the whell of the amount of steps passed as parameter. The adjust is used to calibrate the position of the filters and the slots. It also has three read-only properties: position, desc, slots.

What can I gain from this example?

  • the example shows how to read and write specific informations from the CDB using DAO, DAL and WDAL


Links


 Fridge
 

Description

FridgeControl is designed to simulate the behavior of a fridge. This example is fairly complex because it deals with the ACS event channel API, ACS threads, and enumerated properties.  There are a total of four methods and four properties (two of which are enums).

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • thread management using ACS.
  • writing values to read-only BACI properties by using the property's underlying DevIO instance.
  • usage of enum properties via the ACS enum template.
  • standard ACS logging macros.
  • limited CORBA error handling.
  • the implementation and use of an event channel supplier.


Links


 Lamp
 

Description

The class Lamp is a very simple example of a component that simulates the behavior of a lamp.  
It has two asynchronous methods: on(...) and off(...).  It also has one read-write double property: brightness.

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • an understanding of simple asynchronous method implementation accomplished by inheriting methods from the ActionImplementator class.


Links


 Miscellaneous Examples
 Long DevIO Subclass
 

Description

This example should prove to be particularly useful to those developers dealing directly with hardware. The full implementation of a DevIO subclass is presented here and it's usage can be found in the Ramped Power Supply example. DevIOs should be used when you need to keep a BACI property read-only, but also have to change the value of the property dynamically.

What can I gain from this example?

  • the complete implementation of a DevIO subclass.
  • limited asynchronous error handling.


Links




 Mount
 

Description

The class Mount simulates the behaviour of an antenna interface.  It provides only two asynchronous methods: objstar(...) and objfix(...).  Both of these methods only write data into virtual read-only double properties: actAz, actEl, cmdAz, and cmdEl.

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • understanding of asynchronous method implementation accomplished by inheriting methods from the baci::ActionImplementator class.
  • asynchronous methods which take in (multiple) parameters.
  • clean implementation of the invokeAction method using an array of function pointers.
  • a "real-world" example dealing with radio astronomy.
  • writing values to read-only BACI properties by using the property's underlying DevIO instance.
  • standard ACS logging macros.
  • ACS asynchronous error handling.


Links


 Power Supply Current
 

Description

PowerSupplyCurrent is provided to show how flexible baci::BACI properties can be. You can also gain a litle insight into how properties are implemented in ACS by reviewing this example.

What can I gain from this example?

  • an example which overrides the ACS implementation of a baci::BACI property.
  • writing values to read-only baci::BACI properties by using the property's underlying DevIO instance.
  • limited ACS logging macros.


Links




 Power Supply
 

Description

The class PowerSupply simulates the behavior of a power supply.  PowerSupply implements three asynchrounous methods (on, off, and reset) and has three RO/RW properties.  One noteworthy item is that some extra functionality has been given to the m_current_p property (a RWdouble).  This property is set to be the PowerSupplyCurrent object (dervied from RWdouble) which overrides the setValue method.  This allows m_current_p to set the value of itself AND m_readback_p (the power supply's actual current) at the same time.

What can I gain from this example?

  • an example derived from the ACS::CharacteristicComponent IDL interface.
  • overriding component lifecycle methods (see execute).
  • an understanding of simple asynchronous method implementation accomplished by inheriting methods from the ActionImplementator class.
  • read-only and read-write property usage.
  • writing values to read-only baci::BACI properties by using the property's underlying DevIO instance.
  • standard ACS logging macros.
  • limited CORBA error handling.
  • asynchronous error handling.
  • classes derived from baci::BACI properties and overriding of baci::BACI property methods.
  • use of smart pointers for properties


Links


 Ramped Power Supply
 

Description

RampedPowerSupply simulates the behavior of a ramped power supply.  All of this class's methods are asynchronous.  What makes RampedPowerSupply special is that it's IDL interface inherits from PowerSupply and the C++ implementation is derived from PowerSupply's C++ implementation. Another interesting aspect of this example is PowerSupply and RampedPowerSupply are defined in two separate IDLs.

What can I gain from this example?

  • the implementation of a component derived from another C++ component implementation.
  • an understanding of simple asynchronous method implementation accomplished by inheriting methods from the ActionImplementator class.
  • read-only and read-write property usage.
  • writing values to read-only BACI properties by using the property's underlying DevIO instance.
  • standard ACS logging macros.
  • limited CORBA error handling.
  • asynchronous error handling.


Links


 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 Examples
 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



Detailed Description