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.
Syntax
AttributeDef create_attribute (in RepositoryId id, in Identifier name, in VersionSpec version, in IDLType type, in AttributeMode mode);
Input parameters
Return values
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);