当前位置: 首页>>代码示例>>C++>>正文


C++ H5Location类代码示例

本文整理汇总了C++中H5Location的典型用法代码示例。如果您正苦于以下问题:C++ H5Location类的具体用法?C++ H5Location怎么用?C++ H5Location使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了H5Location类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setAttributeAsArray

//Create array of type TYPE, versus setAttributeArray that creates a scalar of type array
int ArfFileBase::setAttributeAsArray(DataTypes type, void* data, int size, String path, String name)
{
    H5Location* loc;
    Group gloc;
    DataSet dloc;
    Attribute attr;
    DataType H5type;
    DataType origType;

    if (!opened) return -1;
    try
    {
        try
        {
            gloc = file->openGroup(path.toUTF8());
            loc = &gloc;
        }
        catch (FileIException error) //If there is no group with that path, try a dataset
        {
            dloc = file->openDataSet(path.toUTF8());
            loc = &dloc;
        }

        H5type = getH5Type(type);
        origType = getNativeType(type);

        hsize_t dims = size;

        if (loc->attrExists(name.toUTF8()))
        {
            attr = loc->openAttribute(name.toUTF8());
        }
        else
        {
            DataSpace attr_dataspace(1, &dims); //create a 1d simple dataspace of len SIZE
            attr = loc->createAttribute(name.toUTF8(),H5type,attr_dataspace);
        }

        attr.write(origType,data);

    }
    catch (GroupIException error)
    {
        PROCESS_ERROR;
    }
    catch (AttributeIException error)
    {
        PROCESS_ERROR;
    }
    catch (DataSetIException error)
    {
        PROCESS_ERROR;
    }
    catch (FileIException error)
    {
        PROCESS_ERROR;
    }

    return 0;
}
开发者ID:margoliashlab,项目名称:ArfFormat,代码行数:61,代码来源:ArfFileFormat.cpp

示例2: type

int HDF5FileBase::setAttributeStr(String value, String path, String name)
{
    H5Location* loc;
    Group gloc;
    DataSet dloc;
    Attribute attr;

    if (!opened) return -1;

    StrType type(PredType::C_S1, value.length());
    try
    {
        try
        {
            gloc = file->openGroup(path.toUTF8());
            loc = &gloc;
        }
        catch (FileIException error) //If there is no group with that path, try a dataset
        {
            dloc = file->openDataSet(path.toUTF8());
            loc = &dloc;
        }

        if (loc->attrExists(name.toUTF8()))
        {
            //attr = loc.openAttribute(name.toUTF8());
            return -1; //string attributes cannot change size easily, better not allow overwritting.
        }
        else
        {
            DataSpace attr_dataspace(H5S_SCALAR);
            attr = loc->createAttribute(name.toUTF8(), type, attr_dataspace);
        }
        attr.write(type,value.toUTF8());

    }
    catch (GroupIException error)
    {
        PROCESS_ERROR;
    }
    catch (AttributeIException error)
    {
        PROCESS_ERROR;
    }
    catch (FileIException error)
    {
        PROCESS_ERROR;
    }
    catch (DataSetIException error)
    {
        PROCESS_ERROR;
    }


    return 0;
}
开发者ID:410pfeliciano,项目名称:plugin-GUI,代码行数:56,代码来源:HDF5FileFormat.cpp

示例3: AbstractDs

//--------------------------------------------------------------------------
// Function:	DataSet overload constructor - dereference
///\brief	Given a reference, ref, to an hdf5 location, creates a
///		DataSet object
///\param	loc - IN: Dataset reference object is in or location of
///			  object that the dataset is located within.
///\param	ref - IN: Reference pointer
///\param	ref_type - IN: Reference type - default to H5R_OBJECT
///\exception	H5::DataSetIException
///\par Description
///		\c loc can be DataSet, Group, H5File, or named DataType, that
///		is a datatype that has been named by DataType::commit.
// Programmer	Binh-Minh Ribler - Oct, 2006
// Modification
//	Jul, 2008
//		Added for application convenience.
//--------------------------------------------------------------------------
DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object(), id(H5I_INVALID_HID)
{
    id = H5Location::p_dereference(loc.getId(), ref, ref_type, "constructor - by dereferenced");
}
开发者ID:CommonLibrary,项目名称:hdf5,代码行数:21,代码来源:H5DataSet.cpp

示例4: commit

//--------------------------------------------------------------------------
// Function:	DataType::commit
///\brief	This is an overloaded member function, kept for backward
///		compatibility.  It differs from the above function in that it
///		misses const's.  This wrapper will be removed in future release.
///\param	loc - IN: A location (file, dataset, datatype, or group)
///\param	name - IN: Name of the datatype
///\exception	H5::DataTypeIException
// Programmer	Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
void DataType::commit(H5Location& loc, const H5std_string& name)
{
   p_commit(loc.getId(), name.c_str());
}
开发者ID:MichaelToal,项目名称:hdf5,代码行数:14,代码来源:H5DataType.cpp

示例5: H5Object

//--------------------------------------------------------------------------
// Function:	DataType overload constructor - dereference
///\brief	Given a reference, ref, to an hdf5 group, creates a
///		DataType object
///\param       loc - IN: Location referenced object is in
///\param	ref - IN: Reference pointer
///\param	ref_type - IN: Reference type - default to H5R_OBJECT
///\param	plist - IN: Property list - default to PropList::DEFAULT
///\exception	H5::ReferenceException
// Programmer	Binh-Minh Ribler - Oct, 2006
// Modification
//	Jul, 2008
//		Added for application convenience.
//--------------------------------------------------------------------------
DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object()
{
    id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
开发者ID:MichaelToal,项目名称:hdf5,代码行数:18,代码来源:H5DataType.cpp

示例6:

//--------------------------------------------------------------------------
// Function:	H5Location::dereference
///\brief	Dereferences a reference into an HDF5 object, given an HDF5 object.
///\param	loc - IN: Location of the referenced object
///\param	ref - IN: Reference pointer
///\param	ref_type - IN: Reference type
///\param	plist - IN: Property list - default to PropList::DEFAULT
///\exception	H5::ReferenceException
// Programmer	Binh-Minh Ribler - Oct, 2006
// Modification
//	May, 2008
//		Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist)
{
   p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference"));
}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:17,代码来源:H5Location.cpp

示例7: H5Object

//--------------------------------------------------------------------------
// Function:	Group overload constructor - dereference
///\brief	Given a reference, ref, to an hdf5 group, creates a Group object
///\param	loc - IN: Specifying location referenced object is in
///\param	ref - IN: Reference pointer
///\param	ref_type - IN: Reference type - default to H5R_OBJECT
///\exception	H5::ReferenceException
///\par Description
///		\c obj can be DataSet, Group, or named DataType, that
///		is a datatype that has been named by DataType::commit.
// Programmer	Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type) : H5Object(), id(H5I_INVALID_HID)
{
    id = H5Location::p_dereference(loc.getId(), ref, ref_type, "constructor - by dereference");
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:16,代码来源:H5Group.cpp

示例8:

//--------------------------------------------------------------------------
// Function:	H5Location::dereference
///\brief	Dereferences a reference into an HDF5 object, given an HDF5 object.
///\param	loc - IN: Location of the referenced object
///\param	ref - IN: Reference pointer
///\param	ref_type - IN: Reference type
///\param	plist - IN: Property list - default to PropList::DEFAULT
///\exception	H5::ReferenceException
// Programmer	Binh-Minh Ribler - Oct, 2006
// Modification
//	May, 2008
//		Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type)
{
   p_setId(p_dereference(loc.getId(), ref, ref_type, "dereference"));
}
开发者ID:Andy-Sun,项目名称:VTK,代码行数:17,代码来源:H5Location.cpp

示例9: type

int HDF5FileBase::setAttributeStrArray(Array<const char*>& data, int maxSize, String path, String name)
{
	H5Location* loc;
	Group gloc;
	DataSet dloc;
	Attribute attr;
	hsize_t dims[1];

	if (!opened) return -1;

	StrType type(PredType::C_S1, maxSize + 1);
	type.setSize(H5T_VARIABLE);

	try
	{
		try
		{
			gloc = file->openGroup(path.toUTF8());
			loc = &gloc;
		}
		catch (FileIException error) //If there is no group with that path, try a dataset
		{
			dloc = file->openDataSet(path.toUTF8());
			loc = &dloc;
		}

		if (loc->attrExists(name.toUTF8()))
		{
			//attr = loc.openAttribute(name.toUTF8());
			return -1; //string attributes cannot change size easily, better not allow overwritting.
		}
		else
		{
			DataSpace attr_dataspace;
			int nStrings = data.size();
			if (nStrings > 1)
			{
				dims[0] = nStrings;
				attr_dataspace = DataSpace(1, dims);
			}
			else
				attr_dataspace = DataSpace(H5S_SCALAR);
			attr = loc->createAttribute(name.toUTF8(), type, attr_dataspace);
		}
		attr.write(type, data.getRawDataPointer());

	}
	catch (GroupIException error)
	{
		PROCESS_ERROR;
	}
	catch (AttributeIException error)
	{
		PROCESS_ERROR;
	}
	catch (FileIException error)
	{
		PROCESS_ERROR;
	}
	catch (DataSetIException error)
	{
		PROCESS_ERROR;
	}


	return 0;

}
开发者ID:cstawarz,项目名称:open-ephys-plugin-gui,代码行数:68,代码来源:HDF5FileFormat.cpp


注:本文中的H5Location类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。