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


C++ DataDescriptor::getType方法代码示例

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


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

示例1: execute

bool ModelExporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   Progress* pProgress = NULL;
   FileDescriptor* pFileDescriptor = NULL;
   DataElement* pElement = NULL;

   StepResource pStep("Export model element", "app", "2BF48AAB-4832-4694-8583-882A8D584E97");

   // get input arguments and log some useful info about them
   { // scope the MessageResource
      MessageResource pMsg("Input arguments", "app", "1B02F950-2E04-4BEF-8561-BB8D993340F7");

      pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
      pMsg->addBooleanProperty("Progress Present", (pProgress != NULL));

      pFileDescriptor = pInArgList->getPlugInArgValue<FileDescriptor>(Exporter::ExportDescriptorArg());
      if (pFileDescriptor == NULL)
      {
         if (pProgress != NULL)
         {
            pProgress->updateProgress("No file specified", 100, ERRORS);
         }
         pStep->finalize(Message::Failure, "No file specified");
         return false;
      }
      pMsg->addProperty("Destination", pFileDescriptor->getFilename());

      pElement = pInArgList->getPlugInArgValueUnsafe<DataElement>(Exporter::ExportItemArg());
      if (pElement == NULL)
      {
         if (pProgress != NULL)
         {
            pProgress->updateProgress("No model element specified", 100, ERRORS);
         }
         pStep->finalize(Message::Failure, "No model element specified");
         return false;
      }
      pMsg->addProperty("Name", pElement->getName());
   }

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Open output file", 10, NORMAL);
   }
   FILE* pFile = fopen(pFileDescriptor->getFilename().getFullPathAndName().c_str(), "w");
   if (pFile == NULL)
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("File can not be created", 100, ERRORS);
      }
      pStep->finalize(Message::Failure, "File can not be created");
      return false;
   }

   DataDescriptor* pElementDescriptor = pElement->getDataDescriptor();
   VERIFY(pElementDescriptor != NULL);

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Save element", 20, NORMAL);
   }
   string elementName = pElementDescriptor->getType();
   XMLWriter xml(elementName.c_str(), Service<MessageLogMgr>()->getLog());
   if (!pElement->toXml(&xml))
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("Error saving model element", 100, ERRORS);
      }
      pStep->finalize(Message::Failure, "Error saving model element");
      return false;
   }
   else
   {
      xml.writeToFile(pFile);
   }
   fclose(pFile);

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Finished saving the model element", 100, NORMAL);
   }
   pStep->finalize(Message::Success);
   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:86,代码来源:ModelExporter.cpp


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