int server() { printf("Give me the printer Number : 0 or 1"); int no; scanf("%d",&no); char buffer[256] = { '\0' }; // Create a local endpoint. if(no==0) sprintf(buffer, "tcp://58.198.176.121:5555"); else sprintf(buffer, "tcp://58.198.176.121:5557"); Theron::EndPoint endPoint("server", buffer); // Connect to the remote endpoint. sprintf(buffer, "tcp://58.198.176.121:5556"); if (!endPoint.Connect(buffer)) { printf("ERROR: Connection failed - check networking is enabled.\n"); return 1; } // The framework and receiver are tied to the endpoint. if(no==0) { //Theron::Receiver receiver(endPoint, "receiver"); Theron::Framework framework(endPoint); Printer printer(no,framework, "printer"); Printer1 printer1(no,framework, "printer1"); //receiver.Wait(); while(1); } else { Theron::Receiver receiver(endPoint, "receiver1"); Theron::Framework framework(endPoint); Printer printer1(no,framework,"printer"); receiver.Wait(); } }
void QueryWizard::addPages(QueryResult* data) { ASSERT(data != NULL); StoreChooseWizardPage* storeChoosePage = new StoreChooseWizardPage(this); storeChoosePage->initWithFramework(framework()); addPage(storeChoosePage); Settings* settings = framework()->settings(); QVariant mode = settings->get(APP_SETTINGS, APP_QUERY_MODE, APP_QUERY_MODE_BUILDER); if(mode.toString() != APP_QUERY_MODE_PLAIN_QUERY) addPage(new AdvancedQueryPage(this)); else addPage(new AdvancedQueryPage(this)); QueryFinishWizardPage* finishPage = new QueryFinishWizardPage(this); finishPage->initWithFramework(framework()); finishPage->setResultData(data); addPage(finishPage); }
int client() { char buffer[256] = { '\0' }; // Create a local endpoint. sprintf(buffer, "tcp://58.198.176.121:5556"); Theron::EndPoint endPoint("client", buffer); // Connect to the remote endpoint. sprintf(buffer, "tcp://58.198.176.121:5555"); if (!endPoint.Connect(buffer)) { printf("ERROR: Connection failed - check networking is enabled.\n"); return 1; } else { printf("Connected to %s\n",buffer); } sprintf(buffer, "tcp://58.198.176.121:5557"); if (!endPoint.Connect(buffer)) { printf("ERROR: Connection failed - check networking is enabled.\n"); return 1; } else { printf("Connected to %s\n",buffer); } // The framework is tied to the endpoint. Theron::Framework framework(endPoint); // Send messages to the server in a loop until the user enters 'exit'. // Note that if the server hasn't started listening yet it may miss the first messages! printf("Enter lines of text (max 256 chars per line). Type 'exit' to end.\n"); while (strcmp(buffer, "exit") != 0) { // Send the text in a messages to the remote 'printer' actor using its unique name. gets(buffer); framework.Send( TextMessage(buffer), Theron::Address(), Theron::Address("printer")); framework.Send( double(28.234), Theron::Address(), Theron::Address("printer1")); } }
void QueryFinishWizardPage::initializePage() { m_result->clear(); ui.progressBar->setValue(0); Framework* fw = framework(); setCurrentAction(tr("Collecting information...")); quint32 storeId = field("store").value<quint32>(); const QString queryStr = field("query").toString(); setCurrentAction(tr("Looking for store...")); const DataStore* dataStore = fw->dataStoreById(storeId); if(dataStore == NULL) return; setCurrentAction(tr("Store found...")); setCurrentAction(tr("Parsing query...")); CGSQL_NS::RootNode *root = CGSQL_NS::QueryParser::parse(queryStr.toStdString()); if (root == NULL) { setCurrentAction("Error while parting query."); return; } pgn::GameCollection loadedGames; setCurrentAction(tr("Retrieving games from %1...").arg(dataStore->name().toLower())); bool loadResult = dataStore->load(root, loadedGames); if(!loadResult) { setCurrentAction(tr("Can not load games from %1...").arg(dataStore->name().toLower())); return; } setCurrentAction(tr("Loaded %1 games. Looking for concepts in its...").arg(loadedGames.size())); QProgressDialog* progressDialog = new QProgressDialog("Searching for concepts", "Cancel", 0, loadedGames.size()); progressDialog->setWindowModality(Qt::WindowModal); progressDialog->setValue(0); int progress = 0; for(pgn::GameCollection::iterator it = loadedGames.begin(); it != loadedGames.end(); ++it) { progressDialog->show(); m_result->data().addGame(&(*it)); if(root->body()->accept(&(m_result->data()))) m_result->games().insert(*it); progressDialog->setValue(progress); ++progress; } progressDialog->setValue(100); progressDialog->setAutoClose(true); progressDialog->reset(); progressDialog->show(); progressDialog->deleteLater(); ui.progressBar->setValue(100); }
int main(int argc, char **argv) { if (argc < 2) { cout << "Usage: ./OpenChat configFileName" << endl; return 0; } string fileName = argv[1]; openchat::ChatFramework framework(fileName, cin); // add cout view boost::shared_ptr<openchat::StreamPrinter> coutView(new openchat::StreamPrinter(std::cout)); framework.addViewObserver(coutView); // launch the service framework.run(); return 0; }
int main(int, char**) { framework(); shared(); #if defined(WIN32) HANDLE lib = LoadLibraryA("module1.dll"); if (!lib) { printf("Failed to open module1\n"); } #else void* lib = dlopen("module1.so", RTLD_LAZY); if (!lib) { printf("Failed to open module1\n%s\n", dlerror()); } #endif return lib == 0 ? 1 : 0; }
void options(void) { int option; stop: printf("\nWhat would you like to do? (*INPUT INTEGER ONLY*)\n 1 = SIGN IN 2 = CREATE AN ACCOUNT 3 = EXIT\n\n -> "); scanf("%d", &option); system("clear"); if (option == 3) { exit(EXIT_SUCCESS); //sys.exit() equivalent } else if (option == 1 || option == 2) { framework(option); //calling framework for atm } goto stop; }
int main(int argc, char** argv) { Framework framework(argc, argv); MainWindow mainWindow("JanETH ROS Viewer"); mainWindow.addView<GLView>("OpenGL"); mainWindow.addView<GraphicsView>("GraphicsView"); mainWindow.addView<PlotView>("GnuPlot"); ros::init(argc, argv, "janeth_ros_viewer"); ros::NodeHandle nh("~"); mainWindow.addControl<SceneControl>("Scene"); std::vector<std::string> cameraSerials = {"GX002408", "GX002538", "GX002537", "GX002541", "GX002409", "GX002540", "GX002536", "GX002539"}; mainWindow.addControl<RosControl>("ROS", nh, cameraSerials); mainWindow.addControl<PoslvControl>("Applanix POS LV"); mainWindow.addControl<VelodyneControl>("Velodyne HDL", Eigen::Translation3d(1.059, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitX())); // front global camera mainWindow.addControl<CameraControl>("MV GX002408 - Front global", "GX002408", Eigen::Translation3d(1.635, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); // front rolling camera mainWindow.addControl<CameraControl>("MV GX002538 - Front rolling", "GX002538", Eigen::Translation3d(1.635, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); // right global camera mainWindow.addControl<CameraControl>("MV GX002537 - Right global", "GX002537", Eigen::Translation3d(0.462, -0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // right rolling camera mainWindow.addControl<CameraControl>("MV GX002541 - Right rolling", "GX002541", Eigen::Translation3d(0.462, -0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // back global camera mainWindow.addControl<CameraControl>("MV GX002409 - Back global", "GX002409", Eigen::Translation3d(0.332, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // back rolling camera mainWindow.addControl<CameraControl>("MV GX002540 - Back rolling", "GX002540", Eigen::Translation3d(0.332, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // left global camera mainWindow.addControl<CameraControl>("MV GX002536 - Left global", "GX002536", Eigen::Translation3d(0.462, 0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); // left rolling camera mainWindow.addControl<CameraControl>("MV GX002539 - Left rolling", "GX002539", Eigen::Translation3d(0.462, 0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); mainWindow.show(); return framework.exec(); }
// Entry point for the Application // int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cp, int show) { Framework framework(hinst, show); return framework.run(); }
int main(int argc, char** argv) { Framework framework(argc, argv); MainWindow mainWindow("JanETH BAG Viewer"); mainWindow.addView<GLView>("OpenGL"); mainWindow.addView<GraphicsView>("GraphicsView"); mainWindow.addView<PlotView>("GnuPlot"); mainWindow.addControl<SceneControl>("Scene"); mainWindow.addControl<BagControl>("Log"); mainWindow.addControl<PoslvControl>("Applanix POS LV"); mainWindow.addControl<VelodyneControl>("Velodyne HDL", Eigen::Translation3d(1.059, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitX())); // front global camera mainWindow.addControl<CameraControl>("MV GX002408 - Front global", "GX002408", Eigen::Translation3d(1.635, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); // front rolling camera mainWindow.addControl<CameraControl>("MV GX002538 - Front rolling", "GX002538", Eigen::Translation3d(1.635, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); // right global camera mainWindow.addControl<CameraControl>("MV GX002537 - Right global", "GX002537", Eigen::Translation3d(0.462, -0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // right rolling camera mainWindow.addControl<CameraControl>("MV GX002541 - Right rolling", "GX002541", Eigen::Translation3d(0.462, -0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // back global camera mainWindow.addControl<CameraControl>("MV GX002409 - Back global", "GX002409", Eigen::Translation3d(0.332, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // back rolling camera mainWindow.addControl<CameraControl>("MV GX002540 - Back rolling", "GX002540", Eigen::Translation3d(0.332, 0, 0.967) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitX())); // left global camera mainWindow.addControl<CameraControl>("MV GX002536 - Left global", "GX002536", Eigen::Translation3d(0.462, 0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); // left rolling camera mainWindow.addControl<CameraControl>("MV GX002539 - Left rolling", "GX002539", Eigen::Translation3d(0.462, 0.59, 0.967) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(-M_PI / 2.0, Eigen::Vector3d::UnitX())); mainWindow.show(); return framework.exec(); }
int main(int, char**) { framework(); return 0; }
//================================================================== bool RibRendToy::RenderFile( bool renderLastUsed, int forcedWd/*=-1*/, int forcedHe/*=-1 */ ) { const char *pFileName; if ( renderLastUsed ) { if ( mLastFileName.length() ) { pFileName = mLastFileName.c_str(); if ( forcedWd == mLastUsedWd && forcedHe == mLastUsedHe ) { return false; } if ( forcedWd == -1 ) { forcedWd = mLastUsedWd; forcedHe = mLastUsedHe; } } else return false; } else { // remember the last used file name mLastFileName = mFileToRender; pFileName = mFileToRender; } if NOT( pFileName[0] ) return false; DStr baseDir = DUT::GetDirNameFromFPathName( pFileName ); char defaultShadersDir[4096]; sprintf( defaultShadersDir, "%s/Shaders", mExeResPath ); printf( "Base Dir: %s\n", baseDir.c_str() ); printf( "Default Shaders Dir: %s\n", defaultShadersDir ); RI::Framework::Params fwParams; fwParams.mFallBackFBuffDisplay = true; fwParams.mpHiderParams = &mHiderParams; RI::Framework framework( fwParams ); DIO::FileManagerDisk fileManager; RRL::Render::Params params; params.mTrans.mState.mpFramework = &framework; params.mTrans.mState.mpFileManager = &fileManager; params.mTrans.mState.mBaseDir = baseDir; params.mTrans.mState.mDefaultShadersDir = defaultShadersDir; if ( mHiderParams.mDbgColorCodedGrids ) params.mTrans.mState.mForcedSurfaceShader = "constant"; params.mTrans.mForcedWd = forcedWd; params.mTrans.mForcedHe = forcedHe; params.mpFileName = pFileName; params.mpOnFrameEndCB = renderFile_HandleDisplays_s; params.mpOnFrameEndCBData = this; try { RRL::Render render( params ); } catch ( std::bad_alloc ) { printf( "Out of Memory !!!\n" ); return false; } catch ( RI::Exception &e ) { printf( "%s\nAborting.\n", e.GetMessage_().c_str() ); return false; } catch ( ... ) { printf( "Unknown exception. Aborting.\n" ); return false; } return true; }