void FieldContainer::dumpFieldInfo(void) const { const TypeObject &oType = this->getType(); fprintf(stderr, "Dump Container (%s) Field Info\n", oType.getCName()); for(UInt32 i = 1; i <= oType.getNumFieldDescs(); ++i) { FieldDescriptionBase *pDesc = oType.getFieldDesc(i); if(pDesc != NULL) { UInt32 uiTmp = (_bvChanged & pDesc->getFieldMask()) != 0x0000; UInt32 uiTmp1 = 0x0000; fprintf(stderr, WS30" ch : %x\r", uiTmp); uiTmp = (pDesc->getFlags() & Field::FClusterLocal) != 0x0000; uiTmp1 = (_pFieldFlags->_bClusterLocalFlags & pDesc ->getFieldMask() ) == 0x0000; fprintf(stderr, WS30" cl : %x | %x\r", uiTmp, uiTmp1); uiTmp = (pDesc->getFlags() & Field::FThreadLocal) != 0x0000; uiTmp1 = (_pFieldFlags->_bThreadLocalFlags & pDesc ->getFieldMask() ) == 0x0000; fprintf(stderr, WS30" tl : %x | %x\r", uiTmp, uiTmp1); fprintf(stderr, "(%d) : %s :\r", i, pDesc->getCName()); fprintf(stderr, "\n"); #if 0 fprintf(stderr, "0x%016"PRIx64" 0x%016"PRIx64"\n", _pFieldFlags->_bClusterLocalFlags, pDesc ->getFieldMask()); #endif } else { fprintf(stderr, "(%d) : NULL\n", i); } } }
void FieldContainerType::unmarkFieldsClusterLocal(const BitVector bvFieldMasks) { if(_pPrototype != NULL) { BitVector bCurrent = 0x0002; for(UInt32 i = 1; i <= this->getNumFieldDescs(); ++i) { FieldDescriptionBase *pDesc = this->getFieldDesc(i); if(0x0000 != (bCurrent & bvFieldMasks) && pDesc != NULL) { pDesc->setFlags(pDesc->getFlags() & ~Field::FClusterLocal); _pPrototype->_pFieldFlags->_bClusterLocalFlags |= pDesc->getFieldMask(); } bCurrent <<= 1; } } }
/*! Reads the contents of a field from the stream. It is intended to be used in conjunction with readFieldHeader and uses the information obtained by it (\a fieldName, \a fieldTypeName, \a fieldSize ). If a field is not to be read, but skipped instead, its name can be passed in the \a excludeFields argument. The string has the format: "'name1' 'name2' 'name3'", the spaces between the "'" are mandatory. \param[in] fieldName Name of the field. \param[in] fieldTypeName Type of the field. \param[in] fieldSize Size in bytes of the field. \param[in] excludeFields \param[out] ptrFieldIt Iterator that points to the PtrFieldInfo structure that was created, if this is a "pointer field" - only valid if true is returned. \return True, if the field is a "pointer field", i.e. a field holding pointers to other FieldContainers, false otherwise. */ bool OSBCommonElement::readFieldContent( const std::string &fieldName, const std::string &fieldTypeName, const UInt32 fieldSize, const std::string &excludeFields, PtrFieldListIt &ptrFieldIt ) { OSG_OSB_LOG(("OSBCommonElement::readFieldContent: [%s] [%s] [%u]\n", fieldName.c_str(), fieldTypeName.c_str(), fieldSize)); BinaryReadHandler *rh = editRoot()->getReadHandler(); bool isPtrField = false; FieldDescriptionBase *fieldDesc = getContainer()->getFieldDescription(fieldName.c_str()); if((!excludeFields.empty() ) && (excludeFields.find("'" + fieldName + "'") != std::string::npos) ) { OSG_OSB_LOG(("OSBCommonElement::readFieldContent: " "Skipping excluded field [%s] [%s]\n", fieldName.c_str(), fieldTypeName.c_str())); rh->skip(fieldSize); return false; } if(fieldDesc == 0) { DynFieldContainerInterface *pIf = dynamic_cast<DynFieldContainerInterface *>(getContainer()); if(pIf != NULL) { pIf->addField(fieldTypeName.c_str(), fieldName.c_str()); fieldDesc = getContainer()->getFieldDescription(fieldName.c_str()); } } if(fieldDesc == 0) { FWARNING(("OSBCommonElement::readFieldContent: " "Skipping unknown field [%s] [%s].\n", fieldName.c_str(), fieldTypeName.c_str())); rh->skip(fieldSize); return false; } const FieldType &fieldType = fieldDesc->getFieldType(); UInt32 fieldId = fieldDesc->getFieldId (); BitVector fieldMask = fieldDesc->getFieldMask(); if(fieldType.getContentType().isDerivedFrom( FieldTraits<FieldContainer *>::getMapType()) == true) { ptrFieldIt = readAttachmentMapField(fieldId, fieldSize); isPtrField = true; } else if(fieldType.getContentType().isDerivedFrom( FieldTraits<FieldContainer *>::getType()) == true) { if(fieldType.getClass() == FieldType::ParentPtrField) { rh->skip(fieldSize); isPtrField = false; } else { if(fieldType.getCardinality() == FieldType::SingleField) { ptrFieldIt = readPtrSingleField(fieldId); isPtrField = true; } else if(fieldType.getCardinality() == FieldType::MultiField) { ptrFieldIt = readPtrMultiField(fieldId, fieldSize); isPtrField = true; } } } else { getContainer()->copyFromBin(*rh, fieldMask); isPtrField = false; } return isPtrField; }