Example #1

\brief Lookup a dmz::Mask stored as an unbounded attribute of dmz::UInt32 elements.
\note This function does not have an \a Element parameter. Since a mask
is unbounded, it is not possible to know in advance the number of elements required
to store it. Thus a mask always starts at element zero.
\param[in] AttrHandle Attribute handle.
\param[out] value Variable to be stored.
\return Returns dmz::True if the mask was successfully retrieved.

dmz::Data::lookup_mask (const Handle AttrHandle, Mask &value) const {

   Boolean result (False);

   dataStruct *ds = _state.get_data (AttrHandle);

   if (ds && (ds->Attr.Type == BaseTypeUInt32)) {

      const Int32 ElementSize (ds->Attr.Size);

      if (ElementSize > 0) {

          const Int32 Count (ds->size / ElementSize);

          value.clear ();
          value.grow (Count);

          result = True;

          UInt32 *ptr ((UInt32 *)(ds->data));

          if (ptr) {

             for (Int32 ix = 0; ix < Count; ix++) {

                if (!value.set_sub_mask (ix, ptr[ix])) { result = False; }

   return result;