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


C++ NDAttribute::getValueInfo方法代码示例

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


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

示例1: attrFileNameSet

/** Look up filename related attributes in the NDArray.
 *  If file name or number is found in the NDArray, the values are replacing the existing ones
 *  in the parameter library. If not found the existing settings remain.
 */
asynStatus NDPluginFile::attrFileNameSet()
{
    asynStatus status = asynSuccess;
    NDAttribute *ndAttr;
    char attrFileName[MAX_FILENAME_LEN];
    epicsInt32 attrFileNumber;
    size_t attrFileNameLen;
    NDAttrDataType_t attrDataType;
    NDArray *pArray = this->pArrays[0];

    if (this->useAttrFilePrefix == false)
        return status;

    /* first check if the attribute contain a fileprefix to form part of the filename. */
    ndAttr = pArray->pAttributeList->find(FILEPLUGIN_NAME);
    if (ndAttr != NULL)
    {
        ndAttr->getValueInfo(&attrDataType, &attrFileNameLen);
        if (attrDataType == NDAttrString)
        {
            if (attrFileNameLen > MAX_FILENAME_LEN) attrFileNameLen = MAX_FILENAME_LEN;
            ndAttr->getValue(NDAttrString, attrFileName, attrFileNameLen);
            setStringParam(NDFileName, attrFileName);
        }
    }

    ndAttr = pArray->pAttributeList->find(FILEPLUGIN_NUMBER);
    if (ndAttr != NULL)
    {
        ndAttr->getValueInfo(&attrDataType, &attrFileNameLen);
        if (attrDataType == NDAttrInt32)
        {
            ndAttr->getValue(NDAttrInt32, &attrFileNumber, 0);
            setIntegerParam(NDFileNumber, attrFileNumber);
            // ensure auto increment is switched off when using attribute file numbers
            setIntegerParam(NDAutoIncrement, 0);
        }
    }
    return status;
}
开发者ID:prjemian,项目名称:ADCore,代码行数:44,代码来源:NDPluginFile.cpp

示例2: attrIsProcessingRequired

/** Decide whether or not this frame is intended to be processed by this plugin.
 * By default all frames are processed. The decision not to process a frame is
 * made based on the string value of the FILEPLUGIN_DESTINATION: if the value does not equal
 * either "all" or the ASYN port name of the current plugin the frame is not to be processed.
 * \param[in] pAttrList  A pointer to the current NDArray's attribute list.
 * \returns true if the frame is to be processed. false if the frame is not to be processed.
 */
bool NDPluginFile::attrIsProcessingRequired(NDAttributeList* pAttrList)
{
    char destPortName[MAX_FILENAME_LEN];
    NDAttribute *ndAttr;
    size_t destPortNameLen;
    NDAttrDataType_t attrDataType;

    ndAttr = pAttrList->find(FILEPLUGIN_DESTINATION);
    if (ndAttr != NULL)
    {
        ndAttr->getValueInfo(&attrDataType, &destPortNameLen);
        if (attrDataType == NDAttrString && destPortNameLen > 1)
        {
            if (destPortNameLen > MAX_FILENAME_LEN)
                destPortNameLen = MAX_FILENAME_LEN;
                ndAttr->getValue(NDAttrString, destPortName, destPortNameLen);
            if (epicsStrnCaseCmp(destPortName, "all", destPortNameLen>3?3:destPortNameLen) != 0 &&
                epicsStrnCaseCmp(destPortName, this->portName, destPortNameLen) != 0)
                return false;
        }
    }
    return true;
}
开发者ID:prjemian,项目名称:ADCore,代码行数:30,代码来源:NDPluginFile.cpp

示例3: if

void* epics2hdf::getNDAttr(const char* attr_name, void* attr_val,
      hid_t *datatype)
{
   NDAttrDataType_t attrDataType;
   NDAttribute *pAttr;
   size_t attrDataSize;
   hid_t nd_hdf_type;

   if (strcmp(attr_name, "sysclock") == 0)
   {
      *datatype = H5T_NATIVE_DOUBLE;
      double *x;
      x = (double*) attr_val;
      *x = clock() / CLOCKS_PER_SEC;
   }
   else if (strcmp(attr_name, "timestamp") == 0)
   {
      *datatype = H5T_NATIVE_DOUBLE;
      double *x;
      x = (double*) attr_val;
      *x = pArray->timeStamp;
   }
   else if (strcmp(attr_name, "uniqueId") == 0)
   {
      *datatype = H5T_NATIVE_INT;
      int *x;
      x = (int*) attr_val;
      *x = pArray->uniqueId;
   }
   else if (strcmp(attr_name, "datetime") == 0)
   {
      //2003-04-01T13:01:02 is ISO format.
      time_t rawtime;

      struct tm *today;
      char tstr[128];
      time(&rawtime);
      today = localtime(&rawtime);
      sprintf(tstr, "%04i-%02i-%02iT%02i:%02i:%02i", today->tm_year + 1900,
            today->tm_mon + 1, today->tm_mday, today->tm_hour, today->tm_min,
            today->tm_sec);

      *datatype = H5T_STR_NULLTERM;
      strcpy((char*) attr_val, tstr);

   }
   else
   {
      pAttr = pArray->pAttributeList->find(attr_name);

      if (pAttr != NULL)
      {
         pAttr->getValueInfo(&attrDataType, &attrDataSize);
         nd_hdf_type = type_ndatr2hdf(attrDataType);

         *datatype = nd_hdf_type;

         if (nd_hdf_type >= 0)
         {

            pAttr->getValue(attrDataType, (char *) attr_val, attrDataSize);
         }
         else
         {
            printf("epics2hdf::getNDAttr bad NDAttr datatype %s\n", attr_name);
            *datatype = 0;
            strcpy((char*) attr_val, "Error: Unknown Attribute Datatype");

         }
      } //pAttr
      else
      {
         int attrCount;
         printf("epics2hdf::getNDAttr Could not find NDAttr %s\n", attr_name);
         *datatype = 0;
         strcpy((char*) attr_val, "Error: Unknown Attribute");
         // list the attributes
         printf("List of attributes in image\n");
         pAttr = pArray->pAttributeList->next(NULL);
         for (attrCount = 0; attrCount < pArray->pAttributeList->count();
               attrCount++)
         {

            printf("Attr: %s \n", pAttr->pName);
            pAttr = pArray->pAttributeList->next(pAttr);
         }

      } //pAttr
   }

   return (attr_val);
}
开发者ID:Engbretson,项目名称:IMM_Plugin,代码行数:92,代码来源:NDFileHDF5XML.cpp

示例4: openFile


//.........这里部分代码省略.........
    int tagId = TIFFTAG_START_;
   
    numAttributes_ = this->pFileAttributes->count();
    asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
        "%s:%s this->pFileAttributes->count(): %d\n",
        driverName, functionName, numAttributes_);

    fieldInfo_ = (TIFFFieldInfo**) malloc(numAttributes_ * sizeof(TIFFFieldInfo *));
    if (fieldInfo_ == NULL) {
        asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
            "%s:%s error, fieldInfo_ malloc failed. file: %s\n",
            driverName, functionName, fileName);
        return asynError;
    }
    for (int i=0; i<numAttributes_; ++i) {
        asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
            "%s:%s Initializing %d fieldInfo_ entry.\n",
            driverName, functionName, i);
        fieldInfo_[i] = NULL;
    }
    
    asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
        "%s:%s Looping over attributes...\n",
        driverName, functionName);

    pAttribute = this->pFileAttributes->next(NULL);
    while (pAttribute) {
        const char *attributeName = pAttribute->getName();
        //const char *attributeDescription = pAttribute->getDescription();
        const char *attributeSource = pAttribute->getSource();

        asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
          "%s:%s : attribute: %s, source: %s\n",
          driverName, functionName, attributeName, attributeSource);

        NDAttrDataType_t attrDataType;
        size_t attrSize;
        NDAttrValue value;
        pAttribute->getValueInfo(&attrDataType, &attrSize);
        memset(tagString, 0, MAX_ATTRIBUTE_STRING_SIZE);

        switch (attrDataType) {
            case NDAttrInt8:
            case NDAttrUInt8:
            case NDAttrInt16:
            case NDAttrUInt16:
            case NDAttrInt32:
            case NDAttrUInt32: {
                pAttribute->getValue(attrDataType, &value.i32);
                epicsSnprintf(tagString, MAX_ATTRIBUTE_STRING_SIZE, "%s:%d", attributeName, value.i32);
                break;
            }
            case NDAttrFloat32: {
                pAttribute->getValue(attrDataType, &value.f32);
                epicsSnprintf(tagString, MAX_ATTRIBUTE_STRING_SIZE, "%s:%f", attributeName, value.f32);
                break;
            }
            case NDAttrFloat64: {
                pAttribute->getValue(attrDataType, &value.f64);
                epicsSnprintf(tagString, MAX_ATTRIBUTE_STRING_SIZE, "%s:%f", attributeName, value.f64);
                break;
            }
            case NDAttrString: {
                memset(attrString, 0, MAX_ATTRIBUTE_STRING_SIZE);
                pAttribute->getValue(attrDataType, attrString, MAX_ATTRIBUTE_STRING_SIZE);
                epicsSnprintf(tagString, MAX_ATTRIBUTE_STRING_SIZE, "%s:%s", attributeName, attrString);
                break;
            }
            case NDAttrUndefined:
                break;
            default:
                asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
                          "%s:%s error, unknown attrDataType=%d\n",
                          driverName, functionName, attrDataType);
                return asynError;
                break;
        }

        if (attrDataType != NDAttrUndefined) {
            asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
                "%s:%s : tagId: %d, tagString: %s\n",
                  driverName, functionName, tagId, tagString);
            fieldInfo_[count] = (TIFFFieldInfo*) malloc(sizeof(TIFFFieldInfo));
            populateAsciiFieldInfo(fieldInfo_[count], tagId, attributeName);
            TIFFMergeFieldInfo(output, fieldInfo_[count], 1);
            TIFFSetField(this->output, tagId, tagString);
            ++count;
            ++tagId;
            if ((tagId == TIFFTAG_END_) || (count > numAttributes_)) {
                asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
                    "%s:%s error, Too many tags/attributes for file. tagId: %d, count: %d\n",
                    driverName, functionName, tagId, count);
                break;
            }
        }
        pAttribute = this->pFileAttributes->next(pAttribute);
    }
    
    return(asynSuccess);
}
开发者ID:dhickin,项目名称:ADCore,代码行数:101,代码来源:NDFileTIFF.cpp

示例5: processNode


//.........这里部分代码省略.........
           (strcmp (nodeValue, "NXsensor") ==0) ||
           (strcmp (nodeValue, "NXcapillary") ==0) ||
           (strcmp (nodeValue, "NXcollection") ==0) ||
           (strcmp (nodeValue, "NXdetector_group") ==0) ||
           (strcmp (nodeValue, "NXparameters") ==0) ||
           (strcmp (nodeValue, "NXsubentry") ==0) ||
           (strcmp (nodeValue, "NXxraylens") ==0) ||
           (nodeType && strcmp (nodeType, "UserGroup") == 0) ) {
  nodeName = curNode->ToElement()->Attribute("name");
  if (nodeName == NULL) {
    nodeName = nodeValue;
  }
  stat = NXmakegroup(this->nxFileHandle, (const char *)nodeName, (const char *)nodeValue);
  stat |= NXopengroup(this->nxFileHandle, (const char *)nodeName, (const char *)nodeValue);
  if (stat != NX_OK ) {
    asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
              "%s:%s Error creating group %s %s\n",
              driverName, functionName, nodeName, nodeValue);
  }
  this->iterateNodes(curNode, pArray);
  stat = NXclosegroup(this->nxFileHandle);
  if (stat != NX_OK ) {
    asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
              "%s:%s Error closing group %s %s\n",
              driverName, functionName, nodeName, nodeValue);
    }
  }
  else if (strcmp (nodeValue, "Attr") ==0) {
    nodeName = curNode->ToElement()->Attribute("name");
    nodeSource = curNode->ToElement()->Attribute("source");
    if (nodeType && strcmp(nodeType, "ND_ATTR") == 0 ) {
      pAttr = this->pFileAttributes->find(nodeSource);
      if (pAttr != NULL ){
        pAttr->getValueInfo(&attrDataType, &attrDataSize);
        this->getAttrTypeNSize(pAttr, &dataOutType, &wordSize);

        if (dataOutType > 0) {
          pValue = calloc( attrDataSize, wordSize );
          pAttr->getValue(attrDataType, (char *)pValue, attrDataSize*wordSize);

          NXputattr(this->nxFileHandle, nodeName, pValue, (int)(attrDataSize/wordSize), dataOutType);

          free(pValue);
        }
      }
      else {
        asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
                  "%s:%s Could not find attribute named %s\n",
                  driverName, functionName, nodeSource);
      }
    }
    else if (nodeType && strcmp(nodeType, "CONST") == 0 ) {
      this->findConstText( curNode, nodeText);
      nodeOuttype = curNode->ToElement()->Attribute("outtype");
      if (nodeOuttype == NULL){
        nodeOuttype = "NX_CHAR";
      }
      dataOutType = this->typeStringToVal((const char *)nodeOuttype);
      if ( dataOutType == NX_CHAR ) {
        nodeTextLen = strlen(nodeText);
      }
      else {
        nodeTextLen = 1;
      }
      pValue = allocConstValue( dataOutType, nodeTextLen);
      constTextToDataType(nodeText, dataOutType, pValue);
开发者ID:dhickin,项目名称:ADCore,代码行数:67,代码来源:NDFileNexus.cpp


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