Пример #1
0
bool RGBDGrabberFactory :: createPmdGrabbers(const ntk::RGBDGrabberFactory::Params &paramss, std::vector<GrabberData>& grabbers)
{
#ifdef NESTK_USE_PMDSDK
    std::vector<std::string> calibration_files;

    // Config dir is supposed to be next to the binaries.
    QDir prev = QDir::current();
    QDir::setCurrent(QApplication::applicationDirPath());

    PmdGrabber* k_grabber = new PmdGrabber();
    if (!k_grabber->connectToDevice())
    {
        delete k_grabber;
        return false;
    }

    GrabberData new_data;
    new_data.grabber = k_grabber;
    new_data.type = PMD;
    new_data.processor = createProcessor(PMD);
    grabbers.push_back(new_data);

    return true;
#else
    return false;
#endif
}
Пример #2
0
CompleteProcessor::CompleteProcessor(PEngineBase engine, CPArea area, const CellValue *defaultValue, IdentifierType ruleId, CPPlanNode child) :
	ProcessorBase(true, engine, false), area(area), defaultValue(defaultValue ? &defaultValueCopy : 0),
	defaultValueCopy(defaultValue ? *defaultValue : CellValue::NullNumeric), repeatCount(0), sourceEnded(false), bFirst(true), ruleId(ruleId)
{
	areaIt = area->pathBegin();
	sourceProcessor = createProcessor(child, true);
	source = sourceProcessor.get();
}
Пример #3
0
void CombinationProcessorBase::createInputProcessors(const vector<PPlanNode> &rchildren)
{
	size_t size = rchildren.size();
	inputs.resize(size);

	for (size_t i = 0; i < size; i++) {
		inputs[i] = createProcessor(rchildren[i], true);
	}
}
Пример #4
0
bool RGBDGrabberFactory :: createOpenni2Grabbers(const ntk::RGBDGrabberFactory::Params &params, std::vector<GrabberData>& grabbers)
{
#ifdef NESTK_USE_OPENNI2
    if (!Openni2Driver::hasDll())
    {
        ntk_warn("OpenNI2: No dll found.\n");
        return false;
    }

    // Drivers dll are supposed to be next to the binaries.
    QDir prev = QDir::current();
    QDir::setCurrent(QApplication::applicationDirPath());

    ni2_driver = new Openni2Driver();

    if (!ni2_driver->isReady())
    {
        ntk_error("OpenNI2: %s\n", ni2_driver->getLastError().toUtf8().constData());
        return false;
    }

    Openni2Driver::SensorInfos sensorInfos;
    ni2_driver->getSensorInfos(sensorInfos);

    ntk_info("OpenNI2: Number of devices: %d\n", sensorInfos.size());
    ntk_dbg_print(sensorInfos.size(), 1);

    // Create grabbers.
    for (unsigned n = 0; n < sensorInfos.size(); ++n)
    {
        Openni2Grabber* grabber = new Openni2Grabber(*ni2_driver, sensorInfos[n].uri);

        if (params.high_resolution)
            grabber->setHighRgbResolution(true);

        grabber->setCustomBayerDecoding(false);
        grabber->setUseHardwareRegistration(params.hardware_registration);

        GrabberData data;
        data.grabber = grabber;
        data.type = OPENNI2;
        data.processor = createProcessor(OPENNI2);

        grabbers.push_back(data);
    }

    QDir::setCurrent(prev.absolutePath());

    return sensorInfos.size() > 0;
#else
    return false;
#endif
}
Пример #5
0
   void init() {

      createProcessor();

      m_reader = new InfoReader( m_queue.get(), 
                                 m_senderReceiver->getSendQueue(),
                                 m_loadedMaps.get(), 
                                 m_packetReader.get(), 
                                 m_senderReceiver->getPort(),
                                 m_rank, 
                                 !m_noTraffic );
      Module::init();
   }
Пример #6
0
std::shared_ptr<core::Processor> ExecutionPlan::createCallback(void *obj,
    std::function<void(core::ProcessSession*, core::ProcessContext *)> ontrigger_callback,
    std::function<void(core::ProcessContext *)> onschedule_callback) {

  auto ptr = createProcessor(CallbackProcessorName, CallbackProcessorName);
  if (!ptr)
    return nullptr;

  std::shared_ptr<processors::CallbackProcessor> processor = std::static_pointer_cast<processors::CallbackProcessor>(ptr);
  processor->setCallback(obj, ontrigger_callback, onschedule_callback);

  return ptr;
}
Пример #7
0
//***************************************************
// A start tag is detected. create a processor and put it on the processor stack.
// Put the tag name on a tag stack, such we can trace the tag path
//***************************************************
void XML_EIDTagHandler::startElement(	const   XMLCh* const    uri,
					const   XMLCh* const    localname,
					const   XMLCh* const    qname,
					const   Attributes&     attrs
				 )
{
	std::wstring localName = FromXMLCh( localname );
	localName = trim(localName);

	TagProcessor* pProcessor = createProcessor(localname, attrs);

	m_ProcessorStack.push(pProcessor);
	m_DataStorage.m_TagStack.push_back(localName);

}
Пример #8
0
   void init() {

      createProcessor();
                                   
      char filename[256];
      sprintf( filename, "route%d.log", rand() );

      m_reader = new RouteReader( m_queue.get(),
                                  m_senderReceiver->getSendQueue(),
                                  m_loadedMaps.get(),
                                  m_packetReader.get(),
                                  m_senderReceiver->getPort(),
                                  m_rank, filename,
                                  false, // not superLeader
                                  NULL, false );  // no push service

      Module::init();
   }
Пример #9
0
bool RGBDGrabberFactory :: createOpenniGrabbers(const ntk::RGBDGrabberFactory::Params &params, std::vector<GrabberData>& grabbers)
{
#ifdef NESTK_USE_OPENNI
    if (!OpenniDriver::hasDll())
    {
        ntk_warn("No OpenNI dll found.\n");
        return false;
    }

    // Config dir is supposed to be next to the binaries.
    QDir prev = QDir::current();
    QDir::setCurrent(QApplication::applicationDirPath());

    ni_driver = new OpenniDriver();

    ntk_info("Number of Openni devices: %d\n", ni_driver->numDevices());
    ntk_dbg_print(ni_driver->numDevices(), 1);

    // Create grabbers.
    for (int i = 0; i < ni_driver->numDevices(); ++i)
    {
        OpenniGrabber* k_grabber = new OpenniGrabber(*ni_driver, i);
        k_grabber->setTrackUsers(false);
        if (params.high_resolution)
            k_grabber->setHighRgbResolution(true);

        k_grabber->setCustomBayerDecoding(false);
        k_grabber->setUseHardwareRegistration(params.hardware_registration);

        GrabberData new_data;
        new_data.grabber = k_grabber;
        new_data.type = OPENNI;
        new_data.processor = createProcessor(OPENNI);
        grabbers.push_back(new_data);
    }

    QDir::setCurrent(prev.absolutePath());

    return ni_driver->numDevices() > 0;
#else
    return false;
#endif
}
Пример #10
0
bool RGBDGrabberFactory :: createFreenectGrabbers(const ntk::RGBDGrabberFactory::Params &params, std::vector<GrabberData>& grabbers)
{
#ifndef NESTK_USE_FREENECT
    return false;
#else
    FreenectGrabber* k_grabber = new FreenectGrabber();

    GrabberData new_data;
    new_data.grabber = k_grabber;
    new_data.type = FREENECT;
    new_data.processor = createProcessor(FREENECT);
    bool ok = k_grabber->connectToDevice();
    if (ok)
        grabbers.push_back(new_data);
    else
      delete k_grabber;

    return ok;
#endif
}
Пример #11
0
void ExecutionPlan::finalize() {
  if (failure_handler_) {
    auto failure_proc = createProcessor(CallbackProcessorName, CallbackProcessorName);

    std::shared_ptr<processors::CallbackProcessor> callback_proc = std::static_pointer_cast<processors::CallbackProcessor>(failure_proc);
    callback_proc->setCallback(nullptr, std::bind(&FailureHandler::operator(), failure_handler_, std::placeholders::_1));

    for (const auto& proc : processor_queue_) {
      for (const auto& rel : proc->getSupportedRelationships()) {
        if (rel.getName() == "failure") {
          relationships_.push_back(connectProcessors(proc, failure_proc, core::Relationship("failure", "failure collector"), true));
          break;
        }
      }
    }

    std::shared_ptr<core::ProcessorNode> node = std::make_shared<core::ProcessorNode>(failure_proc);

    processor_nodes_.push_back(node);

    std::shared_ptr<core::ProcessContext> context = std::make_shared<core::ProcessContext>(node, controller_services_provider_, prov_repo_, flow_repo_, content_repo_);
    processor_contexts_.push_back(context);

    processor_queue_.push_back(failure_proc);
  }

  if (relationships_.size() > 0) {
    relationships_.push_back(buildFinalConnection(processor_queue_.back()));
  } else {
    for (auto processor : processor_queue_) {
      relationships_.push_back(buildFinalConnection(processor, true));
    }
  }

  finalized = true;
}
Пример #12
0
Annotator* AnnotatorFactory::createAnnotator(
    const boost::program_options::variables_map& options) {
    return dynamic_cast<Annotator*>(createProcessor(options));
}
Пример #13
0
bool ConfigReader::createConfig()
{
    bool inProcessingMode = false;
    while(!atEnd())
    {
        TokenType token = readNext();
        // First, check if processing is possible
        if(token == StartElement && name() == "olvisConfig")
        {
            inProcessingMode = true;
            continue;
        }
        if(!inProcessingMode)
            continue;

        switch(token)
        {
        case StartElement:
            if(name() == "makroFilter")
                createMakroFilter();
            else if(name() == "processor")
                createProcessor();
            else if(name() == "buffer")
                createBuffer();
            else if(name() == "join")
                createJoin();
            else if(name() == "filter")
            {
                createFilter();
                // Filter could not be created, cancel loading
                if(mCurrentFilter == -1){
                    return false;
                }
            }
            else if(name() == "port")
                setPort();
            else if(name() == "makroInput")
                addMakroInput();
            else if(name() == "makroOutput")
                addMakroOutput();
            else if(name() == "processorOutput")
                addProcessorOutput();
            else if(name() == "source")
                setSource();
            else if(name() == "connection")
                connectProcessors();
            else if(name() == "inputConnection")
                connectProcessorInput();
            mCurrentData = "";
            break;
        case Characters:
            mCurrentData += text();
            break;
        case EndElement:
            if(name() == "processor")
                mCurrentProcessor = 0;
            else if(name() == "filter")
                mCurrentFilter = 0;
            else if(name() == "port")
                mCurrentPort = "";
            else if(name() == "value")
                setValue();
            else if(name() == "olvisConfig")
                inProcessingMode = false;
            break;
        default:
            break;
        }
    }

    // Default: Return true, as config was loaded
    return true;
}