![]() |
Overview The create_attribute operation adds a new attribute definition to an interface definition on which it is invoked. Original interface InterfaceDef Interface Exceptions CORBA::SystemException
Intended Usage
The create_attribute operation adds a new CORBA::AttributeDef contained in the CORBA::InterfaceDef on which it is invoked. A representation of the new CORBA::AttributeDef object is created in the Interface Repository persistent database and a pointer to the memory representation of the CORBA::AttributeDef object is returned to the caller.
The id, name, version, typedef, and mode attributes are set as specified. The type attribute is also set. The defined_in attribute is initialized to identify the containing CORBA::InterfaceDef.
An error is returned if an object with the specified id already exists within this object's CORBA::RepositoryId, or if an object with the specified name already exists within this CORBA::InterfaceDef.
IDL Syntax
AttributeDef create_attribute (in RepositoryId id, in Identifier name, in VersionSpec version, in IDLType type, in AttributeMode mode);
Input parameters
- mode
- Valid attribute mode values are CORBA::ATTR_NORMAL (read/write access) and CORBA::ATTR_READONLY (read only access).
- name
- The name that will be associated with this CORBA::AttributeDef object in the Interface Repository.
- type_def
- The type_def parameter is a CORBA::IDLType pointer that specifies the type of the CORBA::AttributeDef.
- id
- The id represents the CORBA::RepositoryId that will uniquely identify this CORBA::AttributeDef within the Interface Repository.
- version
- The version number that will be associated with this CORBA::AttributeDef object in the Interface Repository.
Return values
- AttributeDef *
- The returned value is a pointer to the created CORBA::AttributeDef object. The memory is owned by the caller and may be released using CORBA::release.
Example
// C++ // assume 'this_interface' and 'pk_long_ptr' // have already been initialized CORBA::InterfaceDef * this_interface; CORBA::PrimitiveDef * pk_long_ptr; // establish the 'create_attribute' parameters CORBA::RepositoryId rep_id = CORBA::string_dup ("UniqueRepositoryId"); CORBA::Identifier name = CORBA::string_dup ("this_attribute"); CORBA::VersionSpec version = CORBA::string_dup ("1.0"); CORBA::AttributeMode mode = CORBA::ATTR_READONLY; // create the new attribute definition contained in the interface CORBA::AttributeDef * this_attribute; this_attribute = this_interface->create_attribute(rep_id, name, version, pk_long_ptr, mode);