#ifndef TCSCONTROLDEVICE_IDL
#define TCSCONTROLDEVICE_IDL
/*******************************************************************************
* ALMA - Atacama Large Millimiter Array
* (c) Associated Universities Inc., 2005, 2006
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*/


#include <baci.idl>
#include <acscommon.idl>
#pragma prefix "astri"


module tcs {
  /**
   * The DeviceNameMap provides a mapping between the Reference name of a
   * device (e.g. AMC) and the full name of the device component
   * (e.g. )
   */
  struct TCSDeviceNameMap {
    string ReferenceName; //! The (short) reference name
    string FullName;      //! The full name of the component
  };

  /** Sequence for lists of Device Name Maps */
  typedef sequence<TCSDeviceNameMap>       TCSDeviceNameList;


  struct TCSDeviceConfig; // Forward Definition for recursion

  /** Sequence for handling lists of Device Configurations */
  typedef sequence<TCSDeviceConfig> TCSDeviceList;

  /**
   * The DeviceConfig structure holds all information on the configuration of
   * a device, this is a recursive structure which also defines the subdevices
   */
  struct TCSDeviceConfig {
    string Name;          //! Reference Name of the device (e.g. MOUNT)
    TCSDeviceNameList subdevice; //! List of all subdevices of this device
  };


  /**
   * The ControlDevice is a base class for all ControlDevices (Hardware and
   * logical).  It serves two purposes:
   *
   * It's fuction is to implement the heirachacle structure of the Control
   * device tree.  Handling issues of component instanciation and release
   */
  interface TCSControlDevice: ACS::CharacteristicComponent
  {
   
     void createSubdevices(in TCSDeviceConfig configuration, in string parentName);
    /**
     * This function releases all subdevices of the TCSControlDevice.  This
     * is always in the cleanUp ACS lifecycle method but it may be useful to execute it
     * at another time.
     */
    
    void releaseSubdevices();

    /**
     * This function returns the component name for the
     * component that matches the reference name. If
     * the component could not be created it return a zero length
     * string for teh component name. It throws an
     * IllegalParameterException if no components match the specified
     * reference name.
     */
    string getSubdeviceName(in string refName);
     
    string getDeviceReferenceName();

    void setSubdeviceError(in string subdeviceName);

    void clearSubdeviceError(in string subdeviceName);

    boolean inErrorState();

    string getErrorMessage();

  };
};

#endif //! TCSCONTROLDEVICE_IDL
