void DiscretizationBlock::read(
    const H5::CommonFG &loc, const string &entry,
    const shared_ptr<Discretization> &discretization) {
  this->discretization = discretization;
  auto group = loc.openGroup(entry);
  assert(H5::readAttribute<string>(
             group, "type",
             discretization->manifold.lock()->project.lock()->enumtype) ==
         "DiscretizationBlock");
  H5::readAttribute(group, "name", name);
  assert(H5::readGroupAttribute<string>(group, "discretization", "name") ==
         discretization->name);
  if (group.attrExists("offset")) {
    vector<hssize_t> offset, shape;
    H5::readAttribute(group, "offset", offset);
    std::reverse(offset.begin(), offset.end());
    H5::readAttribute(group, "shape", shape);
    std::reverse(shape.begin(), shape.end());
    region = box_t(offset, point_t(offset) + shape);
  }
  if (group.attrExists("active")) {
    // TODO read_active<0>(group, *this, active);
    read_active<1>(group, *this, active);
    read_active<2>(group, *this, active);
    read_active<3>(group, *this, active);
    read_active<4>(group, *this, active);
  }
}
void ParameterValue::read(const H5::CommonFG &loc, const string &entry,
                          const shared_ptr<Parameter> &parameter) {
  this->parameter = parameter;
  value_type = type_empty;
  auto group = loc.openGroup(entry);
  assert(H5::readAttribute<string>(group, "type",
                                   parameter->project.lock()->enumtype) ==
         "ParameterValue");
  H5::readAttribute(group, "name", name);
  assert(H5::readGroupAttribute<string>(group, "parameter", "name") ==
         parameter->name);
  // TODO: Read and interpret objects (shallowly) instead of naively only
  // looking at their names
  if (group.attrExists("data")) {
    auto attr = group.openAttribute("data");
    auto type = attr.getDataType();
    auto cls = type.getClass();
    switch (cls) {
    case H5T_INTEGER:
      H5::readAttribute(group, "data", value_int);
      value_type = type_int;
      break;
    case H5T_FLOAT:
      H5::readAttribute(group, "data", value_double);
      value_type = type_double;
      break;
    case H5T_STRING:
      H5::readAttribute(group, "data", value_string);
      value_type = type_string;
      break;
    default:
      assert(0);
    }
  }
  // Cannot check "configurations" since configurations have not been read yet
  // assert(H5::checkGroupNames(group, "configurations", configurations));
}
Beispiel #3
0
void
AMetaObject::setAttr( const QString &name, const QVariant &value )
{
    if ( value.isNull() && attrExists( name ) ) v_attr.remove( name );
    else v_attr[ name ] = value;
}
Beispiel #4
0
//--------------------------------------------------------------------------
// Function:    H5Object::attrExists
///\brief       This is an overloaded member function, provided for convenience.
///             It differs from the above function in that it takes
///             a reference to an \c H5std_string for \a name.
// Programmer   Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool H5Object::attrExists(const H5std_string& name) const
{
    return(attrExists(name.c_str()));
}
// -----------------------------------------------------------------------------
// CMPXClientList::IsMsgSubscribedL
// -----------------------------------------------------------------------------
//
TBool CMPXClientList::IsMsgSubscribedL(TInt aIndex, const CMPXMessage* aMsg)
    {
    // check the subscriptions
    TBool IsSubScribed(EFalse);
    TInt subCount(iClients[aIndex]->iSubscriptions.Count());

    if (subCount)
        {
        const CMPXMediaArray* subscriptionItems =
                                 iClients[aIndex]->iSubscriptions[0]->ItemsL();
        if (1==subCount && (0== subscriptionItems->Count()))
            {// one empty subscription - send everything
            IsSubScribed = ETrue;
            }
        else
            {// have to check the message against the subscriptions.
            MPX_ASSERT(aMsg);
            const TArray<TMPXAttribute> msgAttrs = aMsg->Attributes();
            TInt msgAttrCount(msgAttrs.Count());
            // iterate subscriptions
            for (TInt subIndex = 0; subIndex<subCount && !IsSubScribed; ++subIndex)
                {
                // iterate items for the current subscription
                subscriptionItems =
                            iClients[aIndex]->iSubscriptions[subIndex]->ItemsL();
                TInt itemCount(subscriptionItems->Count());
                for (TInt itemIndex = 0; itemIndex < itemCount; ++itemIndex)
                    {
                    // check the message attributes for the current subscription item
                    TBool subMatch(ETrue);
                    TInt attrMatchCount(0);
                    CMPXSubscriptionItem* subItem(subscriptionItems->AtL(itemIndex));

                    for (TInt msgAttrIndex = 0; msgAttrIndex < msgAttrCount; ++msgAttrIndex)
                        {
                        TBool attrExists(EFalse);
                        TBool attrMatch(EFalse);
                        const TMPXAttribute& msgAttr( msgAttrs[msgAttrIndex] );

                        if ( subItem->IsSupported(msgAttr))
                            {
                            attrExists = ETrue;

                            if ( subItem->Match( *aMsg, msgAttr ))
                                {
                                attrMatch = ETrue;
                                attrMatchCount++;
                                }
                            }

                        if (attrExists && !attrMatch)
                            {
                            subMatch = EFalse;
                            break;
                            }
                        }

                    // send the message if all attributes that exist in both the message and the subscription
                    // have the same values and all subscription attributes match
                    if ( subMatch && ( attrMatchCount == subItem->Count()) )
                        {
                        IsSubScribed = ETrue;
                        break;
                        }
                    }
                }
            }
        } // else subCount = 0, IsSubScribed = EFalse (default)
    return IsSubScribed;
    }
Beispiel #6
0
//--------------------------------------------------------------------------
// Function:	H5Location::attrExists
///\brief	This is an overloaded member function, provided for convenience.
///		It differs from the above function in that it takes
///		a reference to an \c H5std_string for \a name.
// Programmer	Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool H5Location::attrExists(const H5std_string& name) const
{
   return(attrExists(name.c_str()));
}