Beispiel #1
0
CompassFilter::CompassFilter() :
        magDataSink(this, &CompassFilter::magDataAvailable),
        accelSink(this, &CompassFilter::accelDataAvailable),
        orientDataSink(this, &CompassFilter::orientDataAvailable),
        factor(1)
{
    addSink(&magDataSink, "magsink");
    addSink(&accelSink, "accsink");
    addSink(&orientDataSink, "orientsink");

    addSource(&magSource, "magnorthangle");
}
Beispiel #2
0
Print::Print(QGraphicsObject* parent)
  : Function("print", parent)
{
  setHasOperation(false);
  setHasInputs(true);
  setHasOutputs(false);
  
  Data::Formats in;
  in << Data::DataBlock;
  in << Data::Value;
 
  Sink *input = new Sink(in, this);
  addSink(input);
}
Beispiel #3
0
	// initialize the super class Module as well
	ExampleModule() :
		Module()
	{
		// we need to tell the sink that this module should be
		// called when data was sent to it

		// set defaults for _Stats and _Count
		_Count = 0;
		// we want to have one option, with default value 100
		addOption("stats", "Print statistics every <stats> events.", int64_t(100));
		// we want to have one sink (input) and one source (output)
		addSink("input", "Input");
		addSource("output", "Output");
	}
Beispiel #4
0
void
ODDistrictHandler::myStartElement(int element,
                                  const SUMOSAXAttributes& attrs) {
    switch (element) {
        case SUMO_TAG_TAZ:
            openDistrict(attrs);
            break;
        case SUMO_TAG_TAZSOURCE:
            addSource(attrs);
            break;
        case SUMO_TAG_TAZSINK:
            addSink(attrs);
            break;
        default:
            break;
    }
}
Beispiel #5
0
int main(int argc, char *argv[])
{

  testing::InitGoogleTest(&argc, argv);
  srand(time(NULL));
  std::stringstream fileName;
  fileName << "UnitTest" << geteuid();
  auto uniqueLoggerPtr = g3::LogWorker::createLogWorker();
  auto handle = uniqueLoggerPtr->addSink(std2::make_unique<LogRotate>(fileName.str(), "/tmp/"), &LogRotate::save);

  g3::initializeLogging(uniqueLoggerPtr.get());
  std::cout << "Logging to: " << handle->call(&LogRotate::logFileName).get() << std::endl;

  int return_value = RUN_ALL_TESTS();
  std::this_thread::sleep_for(std::chrono::seconds(5));
  std::cout << "FINISHED WITH THE TESTING" << std::endl;
  return return_value;
}
Beispiel #6
0
TEST(LoggingTest, should_construct_logger_with_custom_sink)
{
  std::string logOutput;
  {
    auto logworker = g2::LogWorker::createWithNoSink();
    auto sinkHandle = logworker->addSink(std2::make_unique<TestSink>(std::ref(logOutput)), &TestSink::write);
    g2::initializeLogging(logworker.get());

    LOG(INFO) << "Hello, Logger!";
  }

  std::size_t found = std::string::npos;
  found = logOutput.find("Hello, Logger!");
  CHECK(found != std::string::npos);

  found = logOutput.find("INFO");
  CHECK(found != std::string::npos);
}