Overview | The create_constant operation creates a new ConstantDef object. |
Original interface | CORBA module: Container Interface |
Exceptions | CORBA::SystemException |
Intended Usage
The create_constant operation creates a new ConstantDef object with the specified type and value. A representation of the new ConstantDef object is created in the Interface Repository persistent database and a pointer to the memory representation of the ContstantDef object is returned to the caller.
Syntax
ConstantDef create_constant (in RepositoryId Id, in Identifier name, in VersionSpec version, in IDLType type, in any value);
Input parameters
Return values
Example
// C++ // repository_ptr and module_one has already been initialized . . . CORBA::Repository * repository_ptr; CORBA::ModuleDef * module_one; CORBA::RepositoryId constants_rep_id; CORBA::Identifier constants_name; CORBA::VersionSpec version; CORBA::ConstantDef * constant_def_one; CORBA::Any constants_value; CORBA::PrimitiveDef * primitive_long; // establish the id, name, and version values for the constant constants_rep_id = CORBA::string_dup ("unique RepositoryID for my constant"); constants_name = CORBA::string_dup ("constant_of_2001"); version = CORBA::string_dup ("1.0"); // establish the Any with a 'value' of 2001 constants_value <<= (CORBA::Long) 2001; // create a PrimitiveDef that represents a CORBA::Long data type primitive_long = repository_ptr-> get_primitive (CORBA::pk_long); // create the new constant that will be contained in module_one constant_def_one = module_one-> create_constant (constants_rep_id, constants_name, version, primitive_long, constants_value);