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


C++ LWARNING函数代码示例

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


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

示例1: tgtAssert

void VolumeIOHelper::loadURL(const std::string& url, VolumeReader* reader) {
    tgtAssert(reader, "null pointer passed");

    try {
        std::vector<VolumeURL> origins = reader->listVolumes(url);
        if (origins.size() > 1) { // if more than one volume listed at URL, show listing dialog
            tgtAssert(volumeListingDialog_, "no volumelistingdialog");
            volumeListingDialog_->setOrigins(origins, reader);
            volumeListingDialog_->show();
        }
        else if (origins.size() == 1) { // load single volume directly
            loadOrigin(origins.front(), reader);
        }
        else {
            LWARNING("No volumes found at URL '" << url << "'");
            QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
            errorMessageDialog->showMessage(QString::fromStdString("No volumes found at '" + url + "'"));
        }
    }
    catch (const tgt::FileException& e) {
        LWARNING(e.what());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage(e.what());
    }
}
开发者ID:dragonlet,项目名称:Voreen,代码行数:25,代码来源:volumeiohelper.cpp

示例2: if

void OTBTextWriterProcessor::saveCSV() {
    
    std::string filename = CSVFile_.get();
    if (!filename.empty())
    {
	hasFileName = true;
    }
  
    if(this->isReady() && hasFileName)
    {
	//Connect with data inport
	inData = inPort_.getData();
	    
	//Write the csv header to file
        std::ofstream outfile;
        outfile.open(CSVFile_.get().c_str());
	outfile << inData;
	outfile.close();
	
	
    }else if(!this->isReady()){
	LWARNING("Input Data not connected");
	return;
    }else if(!hasFileName){
	LWARNING("CSV File Name Not Set");
	return;
    }

    LINFO("CSV written succesfully!");
    
}
开发者ID:MKLab-ITI,项目名称:gnorasi,代码行数:31,代码来源:otbtextwriterprocessor.cpp

示例3: LINFO

void OTBVectorImageReaderProcessor::setSingleBandData() {
    
    if(hasImage && enableSingleBand_.get()){ //Image is loaded and single band output enabled 
	reader->GenerateOutputInformation();
	int bands = reader->GetOutput()->GetNumberOfComponentsPerPixel();
	LINFO("Image has " << bands << " bands.");
	imageList = VectorImageToImageListType::New();
	imageList->SetInput(reader->GetOutput());
	imageList->UpdateOutputInformation();
	
	if(outputBand_.get() <= bands && outputBand_.get() > 0){
            outPort2_.setData(imageList->GetOutput()->GetNthElement(outputBand_.get()-1));
	}
	else{
	    LWARNING("Selected band is out of range. Please select another value.");
	    return;
	}
    }
    else if(!hasImage){
	LWARNING("Image not loaded!");
	return;
    }
    else if(!enableSingleBand_.get()){
	LWARNING("Single Band Output not enabled.");
	return;
    }
    else{
	return;
    }
    
}
开发者ID:MKLab-ITI,项目名称:gnorasi,代码行数:31,代码来源:otbvectorimagereaderprocessor.cpp

示例4: catch

void OTBVectorDataWriterProcessor::saveVectorData() {

    std::string filename = vectorDataFile_.get();
    if (!filename.empty()) {
        hasVectorData = true;
    }

    if(this->isReady() && hasVectorData) {
        writer->SetFileName(filename.c_str());
        writer->SetInput(inPort_.getData());
        try {
            writer->Update();
        } catch (itk::ExceptionObject& err) {
            LWARNING("ExceptionObject caught ! " << err);
            return;
        }
    } else if(!this->isReady()) {
        LWARNING("Writer inport not connected");
        return;
    } else if(!hasVectorData) {
        LWARNING("Vector Data file name not set correctly");
        return;
    }

    LINFO("'" << filename << "'" << " written succesfully!");
}
开发者ID:MKLab-ITI,项目名称:gnorasi,代码行数:26,代码来源:otbvectordatawriterprocessor.cpp

示例5: LWARNING

bool CanvasRenderer::renderToImage(const std::string &filename, tgt::ivec2 dimensions) {
    if (!canvas_) {
        LWARNING("CanvasRenderer::renderToImage(): no canvas assigned");
        renderToImageError_ = "No canvas assigned";
        return false;
    }

    if (!inport_.hasRenderTarget()) {
        LWARNING("CanvasRenderer::renderToImage(): inport has no data");
        renderToImageError_ = "No rendering";
        return false;
    }

    tgt::ivec2 oldDimensions = inport_.getSize();

    // resize texture container to desired image dimensions and propagate change
    if (oldDimensions != dimensions) {
        canvas_->getGLFocus();
        inport_.requestSize(dimensions);
    }

    // render with adjusted viewport size
    bool success = renderToImage(filename);

    // reset texture container dimensions from canvas size
    if (oldDimensions != dimensions) {
        inport_.requestSize(oldDimensions);
    }

    return success;
}
开发者ID:151706061,项目名称:Voreen,代码行数:31,代码来源:canvasrenderer.cpp

示例6: sizeof

void SocketCan::canRead(CANFrame::PtrList &msgs) {

	int s = sizeof(can_frame);
	char buffer[sizeof(can_frame)];
	int readbytes = read(this->socketHandler, buffer, s);
	if (readbytes == -1) {
		int nerr = errno;
		if (nerr == EAGAIN){
			return;
		} else {
			LWARNING("Can") << "read: " << readbytes << " expected: " << s << " failed with: " << nerr << LE;
			throw Poco::Exception("can read failed");
		}
	}
	if (readbytes == 0) {
		return;
	}
	if (readbytes != s) {
		LWARNING("Can") << "read: " << readbytes << " expected: " << s << LE;
		throw Poco::Exception("can read size missmatch");
	}
	std::vector<Poco::UInt8> bytes(s, 0);
	for (int i = 0; i < s; i++) {
		bytes[i] = buffer[i];
	}

	msgs.push_back(new CANFrame(bytes));
}
开发者ID:hadzim,项目名称:fit-mbot,代码行数:28,代码来源:SocketCan.cpp

示例7: LERROR

void VolumeReader::read(VolumeRAM* volume, FILE* fin) {
    if (progress_) {

        size_t max = tgt::max(volume->getDimensions());

        // validate dimensions
        if (max == 0 || max > 1e5) {
            LERROR("Invalid dimensions: " << volume->getDimensions());
            std::ostringstream stream;
            stream << volume->getDimensions();
            throw VoreenException("Invalid dimensions: " + stream.str());
        }

        // no remainder possible because getNumBytes is a multiple of max
        size_t sizeStep = volume->getNumBytes() / static_cast<size_t>(max);

        for (size_t i = 0; i < size_t(max); ++i) {
            if (fread(reinterpret_cast<char*>(volume->getData()) + sizeStep * i, 1, sizeStep, fin) == 0)
                LWARNING("fread() failed");
            progress_->setProgress(static_cast<float>(i) / static_cast<float>(max));
        }
    }
    else {
        if (fread(reinterpret_cast<char*>(volume->getData()), 1, volume->getNumBytes(), fin) == 0)
        LWARNING("fread() failed");
    }
}
开发者ID:151706061,项目名称:Voreen,代码行数:27,代码来源:volumereader.cpp

示例8: LERROR

  void ProgressBar::setProgress(float progress) {
    if (!(progressRange_.x <= progressRange_.y && progressRange_.x >= 0.f && progressRange_.y <= 1.f)) {
      LERROR("invalid progress range");
    }

    if (progress < 0.f) {
      if (!printedErrorMessage_)
        LWARNING("progress value " << progress << " out of valid range [0,1]");
      printedErrorMessage_ = true;
      progress = 0.f;
    }
    else if (progress > 1.f) {
      if (!printedErrorMessage_)
        LWARNING("progress value " << progress << " out of valid range [0,1]");
      printedErrorMessage_ = true;
      progress = 1.f;
    }
    else {
      printedErrorMessage_ = false;
    }

    progress_ = progressRange_.x + progress*(progressRange_.y - progressRange_.x);

    update();
  }
开发者ID:alvin-me,项目名称:MIVT,代码行数:25,代码来源:progressbar.cpp

示例9: LWARNING

VARIANT* GpuCapabilitiesWindows::WMIquery(std::string wmiClass, std::string attribute) {

    // Code based upon:  "Example: Getting WMI Data from the Local Computer"
    // http://msdn2.microsoft.com/en-us/library/aa390423.aspx

    if (!isWMIinited()) {
        LWARNING("WMI not initiated");
        return 0;
    }

    HRESULT hres;
    VARIANT* result = 0;

    // Step 6: --------------------------------------------------
    // Use the IWbemServices pointer to make requests of WMI ----
    IEnumWbemClassObject* pEnumerator = NULL;
    std::string query = "SELECT " + attribute + " FROM " + wmiClass;
    hres = pWbemServices_->ExecQuery(
        bstr_t("WQL"),
        bstr_t(query.c_str()),
        WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
        NULL,
        &pEnumerator);

    if (FAILED(hres)) {
        LWARNING("ERROR: WMI query failed: " << query);
        return 0;
    }

    // Step 7: -------------------------------------------------
    // Get the data from the query in step 6 -------------------

    IWbemClassObject* pclsObj = 0;
    ULONG uReturn = 0;

    if (pEnumerator) {
        HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
            &pclsObj, &uReturn);

        if (uReturn) {
            // Get the value of the attribute and store it in result
            result = new VARIANT;
            hr = pclsObj->Get(LPCWSTR(str2wstr(attribute).c_str()), 0, result, 0, 0);
        }
    }

    if (!result) {
        LWARNING("No WMI query result");
    }

    // Clean enumerator and pclsObject
    if (pEnumerator)
        pEnumerator->Release();
    if (pclsObj)
        pclsObj->Release();

    return result;

}
开发者ID:tusharuiit,项目名称:2014-2015_HiwiMedicalXTTVisualization,代码行数:59,代码来源:gpucapabilitieswindows.cpp

示例10: catch

void Processor::serialize(XmlSerializer& s) const {
    // meta data
    metaDataContainer_.serialize(s);

    // misc settings
    s.serialize("name", id_);

    // serialize properties
    PropertyOwner::serialize(s);


    // ---
    // the following entities are static resources (i.e. already existing at this point)
    // that should therefore not be dynamically created by the serializer
    //
    const bool usePointerContentSerialization = s.getUsePointerContentSerialization();
    s.setUsePointerContentSerialization(true);

    // serialize inports using a temporary map
    std::map<std::string, Port*> inportMap;
    for (std::vector<Port*>::const_iterator it = inports_.begin(); it != inports_.end(); ++it)
        inportMap[(*it)->getID()] = *it;
    try {
        s.serialize("Inports", inportMap, "Port", "name");
    }
    catch (SerializationException& e) {
        LWARNING(e.what());
    }

    // serialize outports using a temporary map
    std::map<std::string, Port*> outportMap;
    for (std::vector<Port*>::const_iterator it = outports_.begin(); it != outports_.end(); ++it)
        outportMap[(*it)->getID()] = *it;
    try {
        s.serialize("Outports", outportMap, "Port", "name");
    }
    catch (SerializationException& e) {
        LWARNING(e.what());
    }

    // serialize interaction handlers using a temporary map
    map<string, InteractionHandler*> handlerMap;
    const std::vector<InteractionHandler*>& handlers = getInteractionHandlers();
    for (vector<InteractionHandler*>::const_iterator it = handlers.begin(); it != handlers.end(); ++it)
        handlerMap[(*it)->getID()] = *it;
    try {
        s.serialize("InteractionHandlers", handlerMap, "Handler", "name");
    }
    catch (SerializationException& e) {
        LWARNING(e.what());
    }

    s.setUsePointerContentSerialization(usePointerContentSerialization);
    // --- static resources end ---

}
开发者ID:emmaai,项目名称:fractalM,代码行数:56,代码来源:processor.cpp

示例11: throw

void PythonModule::initialize() throw (VoreenException) {
    VoreenModule::initialize();

    //
    // Initialize Python interpreter
    //
    LINFO("Python version: " << Py_GetVersion());

    // Pass program name to the Python interpreter
    char str_pyvoreen[] = "PyVoreen";
    Py_SetProgramName(str_pyvoreen);

    // Initialize the Python interpreter. Required.
    Py_InitializeEx(false);
    if (!Py_IsInitialized())
        throw VoreenException("Failed to initialize Python interpreter");

    // required in order to use threads.
    PyEval_InitThreads();

    // init ResourceManager search path
    addPath("");
    addPath(VoreenApplication::app()->getScriptPath());
    addPath(VoreenApplication::app()->getModulePath("python/scripts"));

    // init Python's internal module search path
    addModulePath(VoreenApplication::app()->getScriptPath());
    addModulePath(VoreenApplication::app()->getModulePath("python/scripts"));

    //
    // Redirect script output from std::cout to voreen_print function (see above)
    //

    // import helper module
    if (!Py_InitModule("voreen_internal", internal_methods)) {
        LWARNING("Failed to init helper module 'voreen_internal'");
    }

    // load output redirector script and run it once
    std::string filename = "outputcatcher.py";
    LDEBUG("Loading Python init script '" << filename << "'");
    PythonScript* initScript = load(filename);
    if (initScript) {
        if (!initScript->run())
            LWARNING("Failed to run init script '" << filename << "': " << initScript->getLog());
        dispose(initScript);
    }
    else {
        LWARNING("Failed to load init script '" << filename << "'");
    }

    //
    // Create actual Voreen Python bindings
    //
    pyVoreen_ = new PyVoreen();
}
开发者ID:alvatar,项目名称:smartmatter,代码行数:56,代码来源:pythonmodule.cpp

示例12: atof

void OTBKMeansImageClassificationProcessor::saveImage() {
    
    std::string filename = imageFile_.get();
    if (!filename.empty())
    {
	hasImage = true;
    }
  
    if(this->isReady() && hasImage)
    {
        try
        {
	    writer->SetFileName(imageFile_.get());
	    
	    const unsigned int sampleSize =
		  ClassificationFilterType::MaxSampleDimension;
	    const unsigned int parameterSize = numClasses_.get() * sampleSize;
	    KMeansParametersType parameters;
	    parameters.SetSize(parameterSize);
	    parameters.Fill(0);
	    
	    for (unsigned int i = 0; i < numClasses_.get(); ++i)
	    {
		for (unsigned int j = 0; j <
		    inPort_.getData()->GetNumberOfComponentsPerPixel(); ++j)
		{
		    parameters[i * sampleSize + j] = atof(argv[4 + i *
		     inPort_.getData()->GetNumberOfComponentsPerPixel() + j]);
                  
		}
	    }
	    
	    filter->SetCentroids(parameters);
	    filter->SetInput(inPort_.getData());
	    writer->SetInput(filter->GetOutput());
	    writer->Update();
	    
	}
	catch(itk::ExceptionObject& err)
	{
	    LWARNING("ExceptionObject caught !");
	    return;
	}
	
    }else if(!this->isReady()){
	LWARNING("Writer Inport not connected");
	return;
    }else if(!hasImage){
	LWARNING("Image Name Not Set");
	return;
    }

    LINFO("Classiciaction written succesfully!");
    
}
开发者ID:MKLab-ITI,项目名称:gnorasi,代码行数:55,代码来源:otbkmeansimageclassificationprocessor.cpp

示例13: LWARNING

VoreenApplication::~VoreenApplication() {
    if (initializedGL_) {
        if (tgt::LogManager::isInited())
            LWARNING("~VoreenApplication(): OpenGL has not been deinitialized. Call deinitGL() before destruction.");
        return;
    }

    if (initialized_) {
        if (tgt::LogManager::isInited())
            LWARNING("~VoreenApplication(): application has not been deinitialized. Call deinit() before destruction.");
        return;
    }
}
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:13,代码来源:voreenapplication.cpp

示例14: getCurrentCacheDir

bool Cache::store() {
    if(!initialized_)
        return false;

    std::string dir = getCurrentCacheDir();
    if (!FileSys.dirExists(dir)) {
        if(!FileSys.createDirectoryRecursive(dir))
            return false;

        //write property state:
        std::string propertyState = getPropertyState();
        std::string fname = dir + "/propertystate.txt";

        std::fstream out(fname.c_str(), std::ios::out | std::ios::binary);

        if (out.is_open() || !out.bad()) {
            out.write(propertyState.c_str(), propertyState.length());
        }
        else {
            LERROR("Could not write propertystate file!");
            FileSys.deleteDirectoryRecursive(dir);
            return false;
        }

        out.close();

        return storeOutportsToDir(dir);
    }
    else {
        std::string fname = dir + "/propertystate.txt";

        if(FileSys.fileExists(fname)) {
            std::string propertyState = getPropertyState();
            if(stringEqualsFileContent(propertyState, fname))
                return true;
            else {
                LWARNING("PropertyState Collision! Deleting cache entry.");
                FileSys.deleteDirectoryRecursive(dir);
                return storeOutportsToDir(dir);
            }
        }
        else {
            LWARNING("No PropertyState in cache entry! Deleting.");
            FileSys.deleteDirectoryRecursive(dir);
            return storeOutportsToDir(dir);
        }
    }
}
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:48,代码来源:cache.cpp

示例15: LWARNING

bool VoreenVisualization::rebuildShaders() {
    if (sharedContext_)
        sharedContext_->getGLFocus();
    else
        LWARNING("No shared context object");

    bool allSuccessful = true;

    std::vector<Processor*> procs = workspace_->getProcessorNetwork()->getProcessors();
    for(size_t i = 0; i < procs.size(); i++) {
        std::vector<ShaderProperty*> props = procs.at(i)->getPropertiesByType<ShaderProperty>();
        for(size_t j = 0; j < props.size(); j++) {
            if(!props.at(j)->rebuild())
                allSuccessful = false;
        }
    }

    if (!ShdrMgr.rebuildAllShadersFromFile())
        allSuccessful = false;

    if (allSuccessful) {
        evaluator_->invalidateProcessors();
        return true;
    }
    else {
        return false;
    }
}
开发者ID:151706061,项目名称:Voreen,代码行数:28,代码来源:voreenvisualization.cpp


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