// NOTE: We can comment out the variable names of the arguments if we do not use these variables in the code. This will prevent the compiler warning: 
// warning: unused parameter `argc' [-Wunused-parameter]
int main(int /*argc*/, char** /*argv*/) {
  
  SM_INFO_STREAM("Hi, I am a simple example program using the ExampleClass.");

  ExampleClass exampleClass; // Not initialized yet
  
  // We know that exampleClass.getA() will throw because it is not initialized yet. Let's catch this exception here, so we can continue with our program.
  try {
    
    double a = exampleClass.getA();
    SM_INFO_STREAM("a is " << a);
    
  } catch (const std::exception& e) {
    SM_FATAL_STREAM(e.what());
    SM_INFO("I caught an exception. In a real program you probably do not want to continue. Here we do to show some other examples.");
  }
  
  exampleClass.initialize(1.0, 2.0);
  SM_INFO_STREAM("Example class initialized: a = " << exampleClass); // This uses the custom stream operator
  
  // TODO: Initialize with a property tree, how to get path to file?
//   i=system("rospack find example_package");
//   boost::filesystem::path configFile();
//   sm::BoostPropertyTree propertyTree;
//   propertyTree.loadInfo(configFile);
//   exampleClass.initializeWithPropertyTree(propertyTree);
//   SM_INFO_STREAM("I initialized the ExampleClass with the property tree, now Example class is: " << exampleClass); // This uses the custom stream operator
  
  SM_INFO_STREAM("Example program terminated successfully");
  return 0;

}
int _tmain(int argc, _TCHAR* argv[])
{
    ExampleClass sample;

    sample.RunnableMethod1_InOtherThread();
    sample.RunnableMethod2_InOtherThread();

    sample.StopOtherThreads();
}
示例#3
0
文件: main.cpp 项目: gelkin/Geometry
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    ExampleClass p;
    p.show();

    return app.exec();
}
示例#4
0
    void test_signals()
    {
        ExampleClass exampleClass;

        bool bTriggered = false;
        connect(&exampleClass, &ExampleClass::strRWInitChanged, [&](QString &strRWInitChanged){bTriggered = true;});
        exampleClass.setProperty("strRWInit","changed");

        QCOMPARE(exampleClass.getRWInit(), QString("changed"));

    }
int main(int argc, char** argv)
{
    unsigned char buf[4];
    buf[0] = 0x41;
    buf[1] = 0x42;
    buf[2] = 0x43;
    buf[3] = 0x44;

    ExampleClass e;
    e.printBuffer(buf, 4);

    return 0;
}
示例#6
0
int main()
{
    TrialTimes runnerBob("Bob", 1134);
    runnerBob.addTime(20.0);
    runnerBob.addTime(21.6);
    runnerBob.addTime(19.6);
    runnerBob.print();

    TrialTimes runnerSue("Sue", 1532);
    runnerSue.addTime(18.2);
    runnerSue.addTime(17.6);
    runnerSue.addTime(19.5);
    runnerSue.print();

    ExampleClass a;
    std::cout << "\nExampleClass a;\nThe value of a.getA() = " << a.getA() << std::endl;

    return 0;
}
示例#7
0
void ExampleClassTest::testOne() {
    setup();
    d->method();
    CPPUNIT_ASSERT(d->read(12) == 12);
    teardown();
}
示例#8
0
 static void callbackFunctionTwo(void *object, arguments argList)
 {
     ExampleClass *myClass = (ExampleClass *)object;
     myClass->innerCallbackFunctionTwo(argList);
 }