Exemplo n.º 1
0
//===============================================================//
QStringList cdfDataReader::getAttributeList()
{
    long numAtts=0;
    char attName[CDF_ATTR_NAME_LEN256 +1];


    QStringList AttNameList;

    //get the number of attributes in the file
    CDFstatus status = CDFgetNumAttributes(this->fileId, &numAtts);

    if(this->CDFstatusOK(status))
    {
        for(long x = 0; x < numAtts; x++)
        {
            //inquire as to what the attribute is
            status = CDFgetAttrName(this->fileId, x, attName);
            if(this->CDFstatusOK(status))
            {
                //add the name to the list of attributes
                AttNameList.push_back(QString(attName));
            }
        }
    }

    //this list will be empty if an error occured
    return AttNameList;
}
Exemplo n.º 2
0
	/**
	 * @return
	 */
	std::vector<std::string> CDFFileReader::getVariableAttributeNames()
	{
		std::vector<std::string> attributeNames;
		long numAttributes;
		CDFgetNumAttributes(current_file_id, &numAttributes);
		char name[512];
		long attrScope;
		long maxgEntry;
		long maxrEntry;
		long maxzEntry;

		for (int i = 0; i < numAttributes; i++)
		{
			std::string value = "";
			CDFinquireAttr(current_file_id, i,name, &attrScope, &maxgEntry, &maxrEntry, &maxzEntry);
			//CDFgetAttrName(current_file_id, i, buffer);
			if (attrScope == VARIABLE_SCOPE)
			{
				value = name;
				attributeNames.push_back(value);
			}
		}
		return attributeNames;
	}