//----------------------------------------------------------------------------- // Group::PrivEnumAttributes //----------------------------------------------------------------------------- void Group::PrivEnumAttributes() { CDMA_FUNCTION_TRACE("Group::PrivEnumAttributes"); try { // Get handle NexusFilePtr ptrNxFile = m_dataset_ptr->getHandle(); NexusFileAccess auto_open (ptrNxFile); // Opening path ptrNxFile->OpenGroupPath(PSZ(m_path), true); if( ptrNxFile->AttrCount() > 0 ) { NexusAttrInfo AttrInfo; // Iterating on attributes collection for( int rc = ptrNxFile->GetFirstAttribute(&AttrInfo); NX_OK == rc; rc = ptrNxFile->GetNextAttribute(&AttrInfo) ) { // Create cdma Attribute m_attributes_map[AttrInfo.AttrName()] = IAttributePtr(new Attribute( ptrNxFile, AttrInfo ) ); } } m_attributes_loaded = true; } catch( NexusException &e ) { RE_THROW_EXCEPTION(e); } }
svn_error_t * svn_fs_x__rev_file_offset(apr_off_t *offset, svn_fs_x__revision_file_t *file) { SVN_ERR(auto_open(file)); return svn_error_trace(svn_io_file_get_offset(offset, file->file, file->pool)); }
svn_error_t * svn_fs_x__rev_file_read(svn_fs_x__revision_file_t *file, void *buf, apr_size_t nbytes) { SVN_ERR(auto_open(file)); return svn_error_trace(svn_io_file_read_full2(file->file, buf, nbytes, NULL, NULL, file->pool)); }
svn_error_t * svn_fs_x__rev_file_get(apr_file_t **apr_file, svn_fs_x__revision_file_t *file) { SVN_ERR(auto_open(file)); *apr_file = file->file; return SVN_NO_ERROR; }
svn_error_t * svn_fs_x__rev_file_stream(svn_stream_t **stream, svn_fs_x__revision_file_t *file) { SVN_ERR(auto_open(file)); *stream = file->stream; return SVN_NO_ERROR; }
svn_error_t * svn_fs_x__rev_file_info(svn_fs_x__rev_file_info_t *info, svn_fs_x__revision_file_t *file) { SVN_ERR(auto_open(file)); *info = file->file_info; return SVN_NO_ERROR; }
svn_error_t * svn_fs_x__rev_file_name(const char **filename, svn_fs_x__revision_file_t *file, apr_pool_t *result_pool) { SVN_ERR(auto_open(file)); return svn_error_trace(svn_io_file_name_get(filename, file->file, result_pool)); }
svn_error_t * svn_fs_x__rev_file_seek(svn_fs_x__revision_file_t *file, apr_off_t *buffer_start, apr_off_t offset) { SVN_ERR(auto_open(file)); return svn_error_trace(svn_io_file_aligned_seek(file->file, file->block_size, buffer_start, offset, file->pool)); }
//----------------------------------------------------------------------------- // Group::PrivEnumChildren //----------------------------------------------------------------------------- void Group::PrivEnumChildren() { CDMA_FUNCTION_TRACE("PrivEnumChildren"); try { Dataset* dataset_ptr = m_dataset_ptr; NexusFilePtr ptrFile = dataset_ptr->getHandle(); NexusFileAccess auto_open(ptrFile); std::vector<std::string> datasets, groups, classes; ptrFile->OpenGroupPath(PSZ(m_path), true); ptrFile->GetGroupChildren(&datasets, &groups, &classes); for(yat::uint16 ui=0; ui < datasets.size(); ui++) { cdma::IDataItemPtr ptrDataItem = dataset_ptr->getItemFromPath(m_path, datasets[ui]); if( ptrDataItem->hasAttribute("axis") ) { #ifdef CDMA_STD_SMART_PTR m_mapDimensions[ptrDataItem->getName()] = IDimensionPtr(new Dimension( std::dynamic_pointer_cast<DataItem>(ptrDataItem ))); #else m_mapDimensions[ptrDataItem->getName()] = new Dimension( (DataItemPtr)ptrDataItem ); #endif } else { m_mapDataItems[ptrDataItem->getName()] = ptrDataItem; } } for(yat::uint16 ui=0; ui < groups.size(); ui++) { cdma::IGroupPtr ptrGroup = dataset_ptr->getGroupFromPath( m_path + "/" + groups[ui]); m_mapGroups[ ptrGroup->getShortName() ] = ptrGroup; } m_bChildren = true; } catch( NexusException &e ) { RE_THROW_EXCEPTION(e); } }
/* If the footer data in FILE has not been read, yet, do so now. * Index locations will only be read upon request as we assume they get * cached and the FILE is usually used for REP data access only. * Hence, the separate step. */ static svn_error_t * auto_read_footer(svn_fs_x__revision_file_t *file) { if (file->l2p_info.start == -1) { apr_off_t filesize = 0; unsigned char footer_length; svn_stringbuf_t *footer; /* Determine file size. */ SVN_ERR(auto_open(file)); SVN_ERR(svn_io_file_seek(file->file, APR_END, &filesize, file->pool)); /* Read last byte (containing the length of the footer). */ SVN_ERR(svn_io_file_aligned_seek(file->file, file->block_size, NULL, filesize - 1, file->pool)); SVN_ERR(svn_io_file_read_full2(file->file, &footer_length, sizeof(footer_length), NULL, NULL, file->pool)); /* Read footer. */ footer = svn_stringbuf_create_ensure(footer_length, file->pool); SVN_ERR(svn_io_file_aligned_seek(file->file, file->block_size, NULL, filesize - 1 - footer_length, file->pool)); SVN_ERR(svn_io_file_read_full2(file->file, footer->data, footer_length, &footer->len, NULL, file->pool)); footer->data[footer->len] = '\0'; /* Extract index locations. */ SVN_ERR(svn_fs_x__parse_footer(&file->l2p_info.start, &file->l2p_info.checksum, &file->p2l_info.start, &file->p2l_info.checksum, footer, file->file_info.start_revision, filesize - footer_length - 1, file->pool)); file->l2p_info.end = file->p2l_info.start; file->p2l_info.end = filesize - footer_length - 1; } return SVN_NO_ERROR; }