//-***************************************************************************** AbcA::CompoundPropertyWriterPtr CpwData::createCompoundProperty( AbcA::CompoundPropertyWriterPtr iParent, const std::string & iName, const AbcA::MetaData & iMetaData ) { if ( m_madeProperties.count( iName ) ) { ABCA_THROW( "Already have a property named: " << iName ); } PropertyHeaderPtr headerPtr( new PropertyHeaderAndFriends( iName, iMetaData ) ); Alembic::Util::shared_ptr<CpwImpl> ret( new CpwImpl( iParent, m_group->addGroup(), headerPtr, m_propertyHeaders.size() ) ); m_propertyHeaders.push_back( headerPtr ); m_madeProperties[iName] = WeakBpwPtr( ret ); m_hashes.push_back(0); m_hashes.push_back(0); return ret; }
//-***************************************************************************** AbcA::CompoundPropertyWriterPtr BaseCpwImpl::createCompoundProperty( const std::string & iName, const AbcA::MetaData & iMetaData ) { if ( m_madeProperties.count( iName ) ) { ABCA_THROW( "Already have a property named: " << iName ); } hid_t myGroup = getGroup(); AbcA::CompoundPropertyWriterPtr ret( new CpwImpl( this->asCompoundPtr(), myGroup, iName, iMetaData ) ); PropertyHeaderPtr headerPtr( new AbcA::PropertyHeader( ret->getHeader() ) ); m_propertyHeaders.push_back( headerPtr ); m_madeProperties[iName] = WeakBpwPtr( ret ); return ret; }
//-***************************************************************************** AbcA::ScalarPropertyWriterPtr BaseCpwImpl::createScalarProperty( const std::string & iName, const AbcA::MetaData & iMetaData, const AbcA::DataType & iDataType, uint32_t iTimeSamplingIndex ) { if ( m_madeProperties.count( iName ) ) { ABCA_THROW( "Already have a property named: " << iName ); } hid_t myGroup = getGroup(); AbcA::ScalarPropertyWriterPtr ret( new SpwImpl( asCompoundPtr(), myGroup, iName, iMetaData, iDataType, iTimeSamplingIndex ) ); PropertyHeaderPtr headerPtr( new AbcA::PropertyHeader( ret->getHeader() ) ); m_propertyHeaders.push_back( headerPtr ); m_madeProperties[iName] = WeakBpwPtr( ret ); return ret; }
//-***************************************************************************** AbcA::ArrayPropertyWriterPtr CpwData::createArrayProperty( AbcA::CompoundPropertyWriterPtr iParent, const std::string & iName, const AbcA::MetaData & iMetaData, const AbcA::DataType & iDataType, Util::uint32_t iTimeSamplingIndex ) { if ( m_madeProperties.count( iName ) ) { ABCA_THROW( "Already have a property named: " << iName ); } ABCA_ASSERT( iDataType.getExtent() != 0 && iDataType.getPod() != Alembic::Util::kNumPlainOldDataTypes && iDataType.getPod() != Alembic::Util::kUnknownPOD, "createArrayProperty, illegal DataType provided."); // will assert if TimeSamplingPtr not found AbcA::TimeSamplingPtr ts = iParent->getObject()->getArchive()->getTimeSampling( iTimeSamplingIndex ); PropertyHeaderPtr headerPtr( new PropertyHeaderAndFriends( iName, AbcA::kArrayProperty, iMetaData, iDataType, ts, iTimeSamplingIndex ) ); Alembic::Util::shared_ptr<ApwImpl> ret( new ApwImpl( iParent, m_group->addGroup(), headerPtr, m_propertyHeaders.size() ) ); m_propertyHeaders.push_back( headerPtr ); m_madeProperties[iName] = WeakBpwPtr( ret ); m_hashes.push_back(0); m_hashes.push_back(0); return ret; }
//-***************************************************************************** // This layers the children together, and creates void OrImpl::init( std::vector< AbcA::ObjectReaderPtr > & iObjects ) { std::vector< AbcA::ObjectReaderPtr >::iterator it = iObjects.begin(); m_properties.reserve( iObjects.size() ); for ( ; it != iObjects.end(); ++it ) { m_properties.push_back( (*it)->getProperties() ); for ( size_t i = 0; i < (*it)->getNumChildren(); ++i ) { AbcA::ObjectHeader objHeader = (*it)->getChildHeader( i ); bool shouldPrune = ( objHeader.getMetaData().get( "prune" ) == "1" ); bool shouldReplace = ( objHeader.getMetaData().get( "replace" ) == "1" ); ChildNameMap::iterator nameIt = m_childNameMap.find( objHeader.getName() ); size_t index = 0; // brand new child, add it (if not pruning) and continue if ( nameIt == m_childNameMap.end() ) { if ( !shouldPrune ) { index = m_childNameMap.size(); m_childNameMap[ objHeader.getName() ] = index; ObjectHeaderPtr headerPtr( new AbcA::ObjectHeader( objHeader ) ); m_childHeaders.push_back( headerPtr ); m_children.resize( index + 1 ); m_children[ index ].push_back( ObjectAndIndex( *it, i ) ); } continue; } index = nameIt->second; // no prune, so add to existing data if ( !shouldPrune ) { if ( shouldReplace ) { m_children[ index ].clear(); m_childHeaders[ index ]->getMetaData() = AbcA::MetaData(); } // add parent and index to the existing child element, and then // update the MetaData m_children[ index ].push_back( ObjectAndIndex( *it, i ) ); // update the found childs meta data m_childHeaders[ index ]->getMetaData().appendOnlyUnique( objHeader.getMetaData() ); continue; } // prune, time to clear out existing data m_children.erase( m_children.begin() + index ); m_childHeaders.erase( m_childHeaders.begin() + index ); m_childNameMap.erase( nameIt ); // since we removed an element, update the indices in our name map for ( nameIt = m_childNameMap.begin(); nameIt != m_childNameMap.end(); ++nameIt ) { if ( nameIt->second > index ) { nameIt->second --; } } } } }
// ----------------------------------------------------------------------------- // CSTSPinManager::PreparePinMethodL Makes preparation common for all PIN // methods. Checks, is PIN method allowed to use. Gets PIN headers from the // card and if there was not any, generates it. Sets needed PIN UI parameters. // Returns: // iPinApdu: Saves APDU into this member variable // iPinApduResp: Saves response APDU into this member variable // iAuthTypeFirstPin: Saves PIN attributes into this member variable // iAuthTypeSecondPin: Saves PIN attributes into this member variable // iPINParamsFirstPin: Saves PIN UI parameters into this member variable // iPINParamsSecondPin: Saves PIN UI parameters into this member variable // ----------------------------------------------------------------------------- // void CSTSPinManager::PreparePinMethodL( CSTSPinApdu::TSTSPinApduType aPinApduType, TInt aFirstPinID, TInt aUnblockedPinID) { LOG(ESATSA, EInfo, "CSTSPinManager::PreparePinMethodL called"); iPinApduType = aPinApduType; // is pinmethods supported to use with card application if (!iAccessControl->IsAllowedPinMethod()) { ELOG(ESATSA, "CSTSPinManager::PreparePinMethodL, Not supported"); User::Leave(KSTSErrSecurity + KSTSErrSECNoRightsPin); } // gets the pin apdu header part from the card, if there is any TPtrC8 headerPtr(iAccessControl->GetPinHeaderL(aFirstPinID, (TPinApduType) aPinApduType)); iAuthTypeFirstPin->CopyL(iAccessControl->GetPinAttributesL(aFirstPinID)); // leaves if PIN flags does not allow this PIN apdu iAccessControl->CheckPinFlagsL((TPinApduType) aPinApduType); // if pin headers are not found, if (headerPtr == KNullDesC8()) { // Pin reference is used if the APDU headers are not specified in the ACL CSTSPinApdu* pinApdu = CSTSPinApdu::NewL(aPinApduType, iAuthTypeFirstPin->PinAttributes().PinReference(), CSTSApdu::ESTSUICC); delete iPinApdu; iPinApdu = pinApdu; } else { LOG(ESATSA, EInfo, "CSTSPinManager::PreparePinMethodL, specified header used"); CSTSCmdApdu* tmp = CSTSCmdApdu::NewL(headerPtr, CSTSApdu::ESTSUICC); delete iPinApdu; iPinApdu = tmp; } // check is the J2ME application allowed to use this apdu if (!iAccessControl->IsAllowedApduL(iPinApdu->Header())) { ELOG(ESATSA, "CSTSPinManager::PreparePinMethodL, Not allowed"); // if not allowed User::Leave(KSTSErrSecurity + KSTSErrSECIllegalApdu); } SetPINUIParametersL(iAuthTypeFirstPin, iPINParamsFirstPin); // In unblockPIN case we need to initialize parameters of unblocked PIN if (aPinApduType == EUnblockPinAPDU) { LOG(ESATSA, EInfo, "unblock parameters"); iAuthTypeSecondPin->CopyL(iAccessControl->GetPinAttributesL( aUnblockedPinID)); SetPINUIParametersL(iAuthTypeSecondPin, iPINParamsSecondPin); } iRetries = EFirstTime; LOG(ESATSA, EInfo, "-- CSTSPinManager::PreparePinMethodL"); }