CORBA Programming Reference
Retrieves a pointer to the value attribute of the NamedValue object.
CORBA::Any * CORBA::NamedValue::value () const;
This member function retrieves a pointer to the Any object that represents the value attribute of the NamedValue object. This attribute is owned by the NamedValue object, and should not be modified or released.
If the function succeeds, the return value is a pointer to the
Any object contained in the NamedValue object.
If the function does not succeed, an exception is thrown.
NVList is a list of NamedValues. A new NVList is constructed using the ORB::create_list
operation (see CORBA::ORB::create_exception_list). New NamedValues may be constructed as part of an NVList, in any of following ways:
add
—creates an unnamed value, initializing only the flagsadd_item
—initializes name and flagsadd_value
—initializes name, value, and flagsEach of these operations returns the new item.
Elements may be accessed and deleted via zero-based indexing. The add
, add_item
, add_value
, add_item_consume
, and add_value_consume
functions lengthen the NVList
to hold the new element each time they are called. The item
function can be used to access existing elements.
// C++
class NVList
{
public:
ULong count() const;
NamedValue_ptr add(Flags);
NamedValue_ptr add_item(const char*, Flags);
NamedValue_ptr add_value(const char*, const Any&, Flags);
NamedValue_ptr item(ULong);
void remove(ULong);
};
NVList has the following special memory management rules:
add
, add_item
, add_value
, add_item_consume
, add_value_consume
, and item
functions is maintained by the NVList; these return values must not be freed by the caller. char*
parameters to the add_item_consume
and add_value_consume
functions and the Any*
parameter to the add_value_consume
function are consumed by the NVList. The caller may not access these data after they have been passed to these functions because the NVList may copy them and destroy the originals immediately. The caller should use the NamedValue::value()
operation to modify the value
attribute of the underlying NamedValue, if desired.remove
function also calls CORBA::release
on the removed NamedValue.