(* ---------------------------------------------------------------------- *)
(* Common Object Service 
                                                                          *)
(* ---------------------------------------------------------------------- *)
(* ICosProperty - Interface Module for the Common Object Service
                "Object Property Service" 
                                                                          *)
(* ---------------------------------------------------------------------- *)
(* Symbol prefixing: I - Interface Module, C - Class Interface
		     T - Non-class Type,   E - Enumeration Type
		     k - constant          p - parameter to a method
		     a - variable                                         *)
(* ---------------------------------------------------------------------- *)

INTERFACE ICosProperty;

TYPE PPropertySet = PropertySet;

TYPE TObject = RECORD
                aSBH : ilu.CString,
                aType : ilu.CString
              END;

TYPE TAnyList = SEQUENCE of Any;

TYPE Any = UNION
             INTEGER, CARDINAL, BYTE, BOOLEAN, REAL, CHARACTER,
             ilu.CString,
             TObject,
             PPropertySet,
	     TAnyList
           END;

TYPE PropertyName = ilu.CString;
TYPE Property = RECORD
  property-name : PropertyName,
  property-value : Any
END;

TYPE PropertyModeType = ENUMERATION normal, read-only, fixed-normal, fixed-readonly, undefined END;

TYPE PropertyDef = RECORD
  property-name : PropertyName,
  property-value : Any,
  property-mode : PropertyModeType
END;

TYPE PropertyMode = RECORD
  property-name : PropertyName,
  property-mode : PropertyModeType
END;

TYPE PropertyNames = SEQUENCE OF PropertyName;
TYPE Properties = SEQUENCE OF Property;
TYPE PropertiesList = SEQUENCE OF Properties;  (* SWH 6.15.95 *)
TYPE PropertyDefs = SEQUENCE OF PropertyDef;
TYPE PropertyModes = SEQUENCE OF PropertyMode;
TYPE PropertyTypes = SEQUENCE OF PropertyModeType;

EXCEPTION ConstraintNotSupported;
EXCEPTION InvalidPropertyName;
EXCEPTION ConflictingProperty;
EXCEPTION PropertyNotFound;
EXCEPTION UnsupportedTypeCode;
EXCEPTION UnsupportedProperty;
EXCEPTION UnsupportedMode;
EXCEPTION FixedProperty;
EXCEPTION ReadOnlyProperty;

TYPE ExceptionReason = ENUMERATION 
  invalid-property-name, conflicting-property, 
  property-not-found, unsupported-type-code, unsupported-property, 
  unsupported-mode, fixed-property, read-only-property 
END;

TYPE PropertyException = RECORD
  reason : ExceptionReason,
  failing-property-name : PropertyName
END;

TYPE PropertyExceptions = SEQUENCE OF PropertyException;

TYPE MultipleExceptions = RECORD
  exceptions : PropertyExceptions
END;

EXCEPTION MultipleExceptions : MultipleExceptions;

(* ------------------------------------------------------------ *)

TYPE PropertySetFactory = OBJECT OPTIONAL
  METHODS
    create-propertyset () : PropertySet,
    create-constrained-propertyset (allowed-property-types : PropertyTypes, allowed-properties : Properties) : PropertySet
      RAISES ConstraintNotSupported END,
    create-initial-propertyset (initial-properties : Properties) : PropertySet
      RAISES MultipleExceptions END
  END;

(* ------------------------------------------------------------ *)

TYPE PropertySetDefFactory = OBJECT OPTIONAL
  METHODS

    create-propertysetdef () : PropertySetDef,

    create-constrained-propertysetdef (allowed-property-types : PropertyTypes,
        allowed-property-defs : PropertyDefs) : PropertySetDef
      RAISES ConstraintNotSupported END,

    create-initial-propertysetdef (initial-property-defs : PropertyDefs) : PropertySetDef
      RAISES MultipleExceptions END
  END;

(* ------------------------------------------------------------ *)

TYPE PropertySet = OBJECT OPTIONAL
  METHODS
    define-property (property-name : PropertyName, property-value : Any)
      RAISES InvalidPropertyName, ConflictingProperty, UnsupportedTypeCode, UnsupportedProperty, ReadOnlyProperty END,

    define-properties (nproperties : Properties)
      RAISES MultipleExceptions END,

    get-number-of-properties () : CARDINAL,

    get-all-property-names (how-many : CARDINAL, OUT property-names : PropertyNames, OUT rest : PropertyNamesIterator),

    get-property-value (property-name : PropertyName) : Any
      RAISES PropertyNotFound, InvalidPropertyName END,

    get-properties (property-names : PropertyNames, OUT nproperties : Properties) : BOOLEAN,

    get-all-properties (how-many : CARDINAL, OUT nproperties : Properties, OUT rest : PropertiesIterator),

    delete-property (property-name : PropertyName)
      RAISES PropertyNotFound, InvalidPropertyName, FixedProperty END,

    delete-properties (property-names : PropertyNames)
      RAISES MultipleExceptions END,

    delete-all-properties () : BOOLEAN,

    is-property-defined (property-name : PropertyName) : BOOLEAN
      RAISES InvalidPropertyName END
  END;

(* ------------------------------------------------------------ *)

TYPE PropertySetDef = OBJECT OPTIONAL
  SUPERCLASS PropertySet
  METHODS
    get-allowed-property-types (OUT property-types : PropertyTypes),
    get-allowed-properties (OUT property-defs : PropertyDefs),
    define-property-with-mode (property-name : PropertyName, property-value : Any, property-mode : PropertyModeType)
      RAISES InvalidPropertyName, ConflictingProperty, UnsupportedTypeCode, UnsupportedProperty, UnsupportedMode, ReadOnlyProperty END,
    define-properties-with-modes (property-defs : PropertyDefs)
      RAISES MultipleExceptions END,
    get-property-mode (property-name : PropertyName) : PropertyModeType
      RAISES PropertyNotFound, InvalidPropertyName END,
    get-property-modes (property-names : PropertyNames, OUT property-modes : PropertyModes) : BOOLEAN,

    set-property-mode (property-name : PropertyName, property-mode : PropertyModeType)
      RAISES InvalidPropertyName, PropertyNotFound, UnsupportedMode END,

    set-property-modes (property-modes : PropertyModes)
      RAISES MultipleExceptions END
  END;

(* ------------------------------------------------------------ *)

TYPE PropertyNamesIterator = OBJECT OPTIONAL
  METHODS
    reset (),
    next-one (OUT property-name : PropertyName) : BOOLEAN,
    next-n (how-many : CARDINAL, OUT property-names : PropertyNames) : BOOLEAN,
    destroy ()
  END;

(* ------------------------------------------------------------ *)

TYPE PropertiesIterator = OBJECT OPTIONAL
  METHODS
    reset (),
    next-one (OUT aproperty : Property) : BOOLEAN,
    next-n (how-many : CARDINAL, OUT nproperties : Properties) : BOOLEAN,
    destroy ()
  END;

(* ------------------------------------------------------------ *)