本文整理汇总了C++中DataDescriptor类的典型用法代码示例。如果您正苦于以下问题:C++ DataDescriptor类的具体用法?C++ DataDescriptor怎么用?C++ DataDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
vector<ImportDescriptor*> CgmImporter::getImportDescriptors(const string& filename)
{
vector<ImportDescriptor*> descriptors;
if (!filename.empty())
{
FactoryResource<Filename> pFullFilename;
pFullFilename->setFullPathAndName(filename);
ImportDescriptor* pImportDescriptor = mpModel->createImportDescriptor(filename, "AnnotationElement", NULL);
if (pImportDescriptor != NULL)
{
DataDescriptor* pDescriptor = pImportDescriptor->getDataDescriptor();
if (pDescriptor != NULL)
{
FactoryResource<FileDescriptor> pFileDescriptor;
if (pFileDescriptor.get() != NULL)
{
pFileDescriptor->setFilename(filename);
pDescriptor->setFileDescriptor(pFileDescriptor.get());
}
}
descriptors.push_back(pImportDescriptor);
}
}
return descriptors;
}
示例2: test_rgb888_to_yuv
int test_rgb888_to_yuv(const unsigned char *src, int w, int h)
{
int lRetVal = 0;
apexcv::ColorConverter rgb;
DataDescriptor srcImg;
srcImg.InitManual(w/*/4*/, h, (void *)src, (void *)OAL_MemoryReturnAddress((void *)src, ACCESS_PHY), DATATYPE_08U, 4, 1);
DataDescriptor dstImg(w/*/4*/, h, DATATYPE_08U, 4, 1);
DataDescriptor dstRefImg(w/*/4*/, h, DATATYPE_08U, 4, 1);
if(srcImg.IsOK() && dstImg.IsOK() && dstRefImg.IsOK()) {
//run implementation
lRetVal |= rgb.convert(srcImg, dstImg, ColorConverter::RGB888_TO_YUV);
//obtain dst data pointers
unsigned char* pDst = (unsigned char*) dstImg.GetDataPtr();
unsigned char* pDstRef = (unsigned char*) dstRefImg.GetDataPtr();
//run reference
rgb888_to_yuv_ref((uint8_t*)pDstRef, w*4, (uint8_t*)src, w*4, w, h);
if (dstImg == dstRefImg)
lRetVal |= 0;
else
lRetVal |= 1;
} else {
lRetVal |= 1;
}
//free buffers
dstImg.SetFreeOnExit(true);
dstRefImg.SetFreeOnExit(true);
return lRetVal;
}
示例3: test_rgb565_to_rgb888
int test_rgb565_to_rgb888(const unsigned short *src, int w, int h)
{
int lRetVal = 0;
apexcv::ColorConverter rgb;
DataDescriptor srcImg;
srcImg.InitManual(w, h, (void *)src, (void *)OAL_MemoryReturnAddress((void *)src, ACCESS_PHY), DATATYPE_16U);
DataDescriptor dstImg(w, h, DATATYPE_32U);
DataDescriptor dstRefImg(w, h, DATATYPE_32U);
if(srcImg.IsOK() && dstImg.IsOK() && dstRefImg.IsOK()) {
//run implementation
lRetVal |= rgb.convert(srcImg, dstImg, apexcv::ColorConverter::RGB565_TO_RGB888);
//obtain dst data pointers
unsigned int* pDst = (unsigned int*) dstImg.GetDataPtr();
unsigned int* pDstRef = (unsigned int*) dstRefImg.GetDataPtr();
//run reference
rgb565_to_rgb888_ref(pDstRef, w, src, w, w, h);
if (dstImg == dstRefImg)
lRetVal |= 0;
else
lRetVal |= 1;
} else {
lRetVal |= 1;
}
//free buffers
dstImg.SetFreeOnExit(true);
dstRefImg.SetFreeOnExit(true);
return lRetVal;
}
示例4: initialize
bool EngrdaWidget::initialize(SessionItem* pSessionItem)
{
DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
DataDescriptor* pDesc = (pElement == NULL) ? NULL : pElement->getDataDescriptor();
const DynamicObject* pMeta = (pDesc == NULL) ? NULL : pDesc->getMetadata();
return initialize(pMeta);
}
示例5: initialize
bool PropertiesFileDescriptor::initialize(SessionItem* pSessionItem)
{
FileDescriptorWidget* pDescriptorPage = dynamic_cast<FileDescriptorWidget*>(getWidget());
if (pDescriptorPage == NULL)
{
return false;
}
DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
if (pElement != NULL)
{
DataDescriptor* pDescriptor = pElement->getDataDescriptor();
if (pDescriptor != NULL)
{
const FileDescriptor* pFileDescriptor = pDescriptor->getFileDescriptor();
if (pFileDescriptor != NULL)
{
pDescriptorPage->setFileDescriptor(pFileDescriptor);
return true;
}
}
}
return false;
}
示例6: findUniforms
/**
* Finds the shader locations of all uniforms and textures from a given material.
* The input material descriptor has all the possible textures and uniforms
* that can be used by this shader. (Any material used with this shader
* will have the same descriptor.)
*
* This function uses the descriptor of the input material to find and save
* the GL shader locations of each texture and uniform. The locations are
* saved into vectors - mTextureLocs and mUniformLocs. Each vector has an
* entry for all of the uniforms/textures in the input material
* (not just the ones used by this shader). If the shader does not
* reference a particular uniform or texture, that location will be -1.
* This function must be called after the GL shader program has
* been selected as the current program.
* @param material can be any Material which uses this shader
* @see #getUniformLoc
*/
void GLShader::findUniforms(const DataDescriptor& desc, int bindingPoint)
{
std::vector<int>& uniformLocs = mShaderLocs[bindingPoint];
if (uniformLocs.size() > 0)
{
return;
}
uniformLocs.resize(desc.getNumEntries(), -1);
desc.forEachEntry([&](const DataDescriptor::DataEntry& entry) mutable
{
if (entry.NotUsed)
{
return;
}
int loc = glGetUniformLocation(getProgramId(), entry.Name);
if (loc >= 0)
{
uniformLocs[entry.Index] = loc;
#ifdef DEBUG_SHADER
LOGV("SHADER: program %d uniform %s loc %d", getProgramId(), entry.Name, loc);
#endif
}
else
{
#ifdef DEBUG_SHADER
LOGV("SHADER: uniform %s has no location in shader %d", entry.Name, getProgramId());
#endif
}
});
checkGLError("GLShader::findUniforms");
}
示例7: VERIFY
bool DiHdfImporter::createRasterPager(RasterElement *pRaster) const
{
VERIFY(pRaster != NULL);
DataDescriptor *pDescriptor = pRaster->getDataDescriptor();
VERIFY(pDescriptor != NULL);
FileDescriptor *pFileDescriptor = pDescriptor->getFileDescriptor();
VERIFY(pFileDescriptor != NULL);
std::string filename = pRaster->getFilename();
Progress *pProgress = getProgress();
FactoryResource<Filename> pFilename;
pFilename->setFullPathAndName(filename);
ExecutableResource pagerPlugIn("DiHdfRasterPager", std::string(), pProgress);
pagerPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedElementArg(), pRaster);
pagerPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedFilenameArg(), pFilename.get());
bool success = pagerPlugIn->execute();
RasterPager *pPager = dynamic_cast<RasterPager*>(pagerPlugIn->getPlugIn());
if(!success || pPager == NULL)
{
std::string message = "Execution of DiHdfRasterPager failed!";
if (pProgress != NULL) pProgress->updateProgress(message, 0, ERRORS);
return false;
}
pRaster->setPager(pPager);
pagerPlugIn->releasePlugIn();
return true;
}
示例8: int
void Simulation_GUI::StartOrtho()
{
mpStartOrtho->setEnabled(false);
// Update Grid Information
OrthoGrid.X_Step = X_Spacing->value();
OrthoGrid.Y_Step = Y_Spacing->value();
OrthoGrid.X_Dim = int(OrthoGrid.X_Dim/OrthoGrid.X_Step)+1.0;
OrthoGrid.Y_Dim = int(OrthoGrid.Y_Dim/OrthoGrid.Y_Step)+1.0;
OrthoGrid.Lon_Step = (OrthoGrid.Lon_Max-OrthoGrid.Lon_Min)/OrthoGrid.X_Dim;
OrthoGrid.Lat_Step = (OrthoGrid.Lat_Max-OrthoGrid.Lat_Min)/OrthoGrid.Y_Dim;
//Start Ortho
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
FactoryResource<DataRequest> pRequest;
DataAccessor pAcc = pCube->getDataAccessor(pRequest.release());
DataDescriptor* dMeta = pCube->getDataDescriptor();
DynamicObject* oMetadata = dMeta->getMetadata();
// RETRIEVE & UPDATE METADATA INFORMATION //
bool control = Metadata->ReadFile(image_path);
Metadata->UpdateMetadata(oMetadata);
SAR_Model *ModProva;
ModProva = new SAR_Slant_Model(*Metadata, 10);
if(Metadata->Projection == "SGF")
{
ModProva = new SAR_Ground_Model(*Metadata,10);
}
SAR_Simulator_Processor ProcessOrtho(pCube, ModProva, OrthoGrid, Height->value());
// RETRIVE SELECTED RESAMPLING METHOD AND EXECUTE ORTHO
int indexR = mpInterpolationList->currentIndex();
//if (mpFlatten->isChecked() ==true)
//{
//VERIFYNRV(ProcessOrtho.process(indexR));
//}
//else
//{
VERIFYNRV(RetrieveDSMGrid());
VERIFYNRV(ProcessOrtho.process(indexR, pDSM, DSMGrid, GeoidOffSet->value(),mpDSMInterpolationList->currentIndex()));
//}
}
示例9: xml
vector<ImportDescriptor*> LayerImporter::getImportDescriptors(const string& filename, bool reportErrors)
{
vector<ImportDescriptor*> descriptors;
if (!filename.empty())
{
MessageLog* pLog = NULL;
if (reportErrors == true)
{
Service<MessageLogMgr> pLogMgr;
pLog = pLogMgr->getLog();
}
XmlReader xml(pLog);
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDoc = xml.parse(filename, "metadata");
DOMElement* pRootElement = NULL;
if (pDoc != NULL)
{
pRootElement = pDoc->getDocumentElement();
}
if (pRootElement != NULL)
{
for (DOMNode* pChild = pRootElement->getFirstChild();
pChild != NULL;
pChild = pChild->getNextSibling())
{
if (pChild->getNodeType() == DOMNode::ELEMENT_NODE)
{
DOMElement* pChildElement = static_cast<DOMElement*>(pChild);
string cNodeName = A(pChildElement->getNodeName());
ImportDescriptor* pImportDescriptor = ModelImporter::populateImportDescriptor(pChildElement, filename);
if (pImportDescriptor != NULL)
{
DataDescriptor* pDataDescriptor = pImportDescriptor->getDataDescriptor();
if (NULL != pDataDescriptor)
{
DynamicObject* pMetadataZ = pDataDescriptor->getMetadata();
VERIFYRV(pMetadataZ, descriptors);
if (!pMetadataZ->getAttributeByPath("Layer/Import Options/Use Pixel Coordinates").isValid())
{
pMetadataZ->setAttributeByPath("Layer/Import Options/Use Pixel Coordinates", false);
}
}
descriptors.push_back(pImportDescriptor);
}
}
}
}
}
return descriptors;
}
示例10: VERIFYRV
vector<ImportDescriptor*> SignatureSetImporter::createImportDescriptors(DOMTreeWalker* pTree, vector<string> &datasetPath)
{
vector<ImportDescriptor*> descriptors;
FactoryResource<DynamicObject> pMetadata;
VERIFYRV(pMetadata.get() != NULL, descriptors);
string datasetName = StringUtilities::toDisplayString(mDatasetNumber++);
for (DOMNode* pChld = pTree->firstChild(); pChld != NULL; pChld = pTree->nextSibling())
{
if (XMLString::equals(pChld->getNodeName(), X("metadata")))
{
DOMElement* pElmnt = static_cast<DOMElement*>(pChld);
string name = A(pElmnt->getAttribute(X("name")));
string val = A(pElmnt->getAttribute(X("value")));
pMetadata->setAttribute(name, val);
if (name == "Name")
{
datasetName = val;
}
}
else if (XMLString::equals(pChld->getNodeName(), X("signature_set")))
{
datasetPath.push_back(datasetName);
vector<ImportDescriptor*> sub = createImportDescriptors(pTree, datasetPath);
datasetPath.pop_back();
descriptors.insert(descriptors.end(), sub.begin(), sub.end());
pTree->parentNode();
}
}
ImportDescriptorResource pImportDescriptor(datasetName, "SignatureSet", datasetPath);
VERIFYRV(pImportDescriptor.get() != NULL, descriptors);
DataDescriptor* pDataDescriptor = pImportDescriptor->getDataDescriptor();
VERIFYRV(pDataDescriptor != NULL, descriptors);
FactoryResource<SignatureFileDescriptor> pFileDescriptor;
VERIFYRV(pFileDescriptor.get() != NULL, descriptors);
pFileDescriptor->setFilename(mFilename);
datasetPath.push_back(datasetName);
string loc = "/" + StringUtilities::join(datasetPath, "/");
datasetPath.pop_back();
pFileDescriptor->setDatasetLocation(loc);
pDataDescriptor->setFileDescriptor(pFileDescriptor.get());
pDataDescriptor->setMetadata(pMetadata.get());
descriptors.push_back(pImportDescriptor.release());
return descriptors;
}
示例11: applyChanges
bool PropertiesDataDescriptor::applyChanges()
{
if (mpDescriptor.get() == NULL)
{
return false;
}
DataElement* pElement = dynamic_cast<DataElement*>(getSessionItem());
if (pElement != NULL)
{
DataDescriptor* pDescriptor = pElement->getDataDescriptor();
if (pDescriptor != NULL)
{
return pDescriptor->clone(mpDescriptor.get());
}
}
return false;
}
示例12: copy
DataDescriptor* DataDescriptorImp::copy(const string& name, const vector<string>& parent) const
{
ModelServicesImp* pModel = ModelServicesImp::instance();
if (pModel == NULL)
{
return NULL;
}
DataDescriptor* pDescriptor = pModel->createDataDescriptor(name, mType, parent);
if (pDescriptor != NULL)
{
pDescriptor->setClassification(dynamic_cast<const Classification*>(&mClassification));
pDescriptor->setMetadata(dynamic_cast<const DynamicObject*>(&mMetadata));
pDescriptor->setProcessingLocation(mProcessingLocation);
pDescriptor->setFileDescriptor(dynamic_cast<FileDescriptor*>(mpFileDescriptor));
}
return pDescriptor;
}
示例13: makeLayout
std::string GLShader::makeLayout(const DataDescriptor& desc, const char* blockName, bool useGPUBuffer)
{
std::ostringstream stream;
if (useGPUBuffer)
{
stream << "\nlayout (std140) uniform " << blockName << std::endl << "{" << std::endl;
desc.forEachEntry([&stream](const DataDescriptor::DataEntry& entry) mutable
{
int nelems = entry.Count;
stream << " " << entry.Type << " " << entry.Name;
if (nelems > 1)
{
stream << "[" << nelems << "]";
}
stream << ";" << std::endl;
});
stream << "};" << std::endl;
}
else
{
desc.forEachEntry([&stream](const DataDescriptor::DataEntry& entry) mutable
{
if (entry.IsSet)
{
int nelems = entry.Count;
stream << "uniform " << entry.Type << " " << entry.Name;
if (nelems > 1)
{
stream << "[" << nelems << "]";
}
stream << ";" << std::endl;
}
});
}
return stream.str();
}
示例14: test_ht_8UC3_to_y
int test_ht_8UC3_to_y(const uint8_t *src, int w, int h, uint8_t KA, uint8_t KB, uint8_t KC, uint16_t KR)
{
int lRetVal = 0;
apexcv::OPT::ColorConverter rgb;
DataDescriptor srcImg;
srcImg.InitManual(w/*/4*/, h, (void *)src, (void *)OAL_MemoryReturnAddress((void *)src, ACCESS_PHY), DATATYPE_08U, 4, 1);
DataDescriptor dstImg(w/*/4*/, h, DATATYPE_16S);
DataDescriptor dstRefImg(w/*/4*/, h, DATATYPE_16S);
if(srcImg.IsOK() && dstImg.IsOK() && dstRefImg.IsOK()) {
//run implementation
lRetVal |= rgb.convert(srcImg, dstImg, OPT::ColorConverter::HT_8UC3_TO_Y, KA, KB, KC, KR);
//obtain dst data pointers
int16_t* pDst = (int16_t*) dstImg.GetDataPtr();
int16_t* pDstRef = (int16_t*) dstRefImg.GetDataPtr();
//run reference
csc_8UC3_to_y_ref((int16_t*)pDstRef, w, (uint8_t*)src, w*4, w, h, KA, KB, KC, KR);
if (dstImg == dstRefImg)
lRetVal |= 0;
else
lRetVal |= 1;
} else {
lRetVal |= 1;
}
//free buffers
dstImg.SetFreeOnExit(true);
dstRefImg.SetFreeOnExit(true);
return lRetVal;
}
示例15: test_integral_image
int test_integral_image(const unsigned char *src, int w, int h)
{
int lRetVal = 0;
apexcv::IntegralImage i;
DataDescriptor srcImg;
srcImg.InitManual(w, h, (void *)src, (void *)OAL_MemoryReturnAddress((void *)src, ACCESS_PHY), DATATYPE_08U);
DataDescriptor dstImg(w, h, DATATYPE_32U);
DataDescriptor dstRefImg(w, h, DATATYPE_32U);
if(srcImg.IsOK() &&dstImg.IsOK() && dstRefImg.IsOK()) {
//run implementation
lRetVal |= i.exec(srcImg, dstImg);
//obtain dst data pointers
unsigned int* pDst = (unsigned int*) dstImg.GetDataPtr();
unsigned int* pDstRef = (unsigned int*) dstRefImg.GetDataPtr();
//run reference
integral_image_ref(pDstRef, src, w, w, h);
if (dstImg == dstRefImg)
lRetVal |= 0;
else
lRetVal |= 1;
} else {
lRetVal |= 1;
}
//free buffers
dstImg.SetFreeOnExit(true);
dstRefImg.SetFreeOnExit(true);
return lRetVal;
}