コード例 #1
0
ParamList DeEncryptProcessor::paramList() {
    ParamList ret;
    ret.push_back(string_);
    return ret;
}
コード例 #2
0
ファイル: FFConsoleDemo.cpp プロジェクト: azmeuk/OIS
    int initialize()
    {
	  ostringstream wnd;

#if defined OIS_WIN32_PLATFORM

	  //Create a capture window for Input Grabbing
	  _hWnd = CreateDialog( 0, MAKEINTRESOURCE(IDD_DIALOG1), 0,(DLGPROC)DlgProc);
	  if( _hWnd == NULL )
		OIS_EXCEPT(E_General, "Failed to create Win32 Window Dialog!");

	  ShowWindow(_hWnd, SW_SHOW);

	  wnd << (size_t)_hWnd;

#elif defined OIS_LINUX_PLATFORM

	  //Connects to default X window
	  if( !(_pXDisp = XOpenDisplay(0)) )
		OIS_EXCEPT(E_General, "Error opening X!");

	  //Create a window
	  _xWin = XCreateSimpleWindow(_pXDisp,DefaultRootWindow(_pXDisp), 0,0, 100,100, 0, 0, 0);

	  //bind our connection to that window
	  XMapWindow(_pXDisp, _xWin);

	  //Select what events we want to listen to locally
	  XSelectInput(_pXDisp, _xWin, StructureNotifyMask);

	  //Wait for Window to show up
	  XEvent event;
	  do {	XNextEvent(_pXDisp, &event); } while(event.type != MapNotify);

	  wnd << _xWin;

#endif

	  // Create OIS input manager
	  ParamList pl;
	  pl.insert(make_pair(string("WINDOW"), wnd.str()));
	  _pInputMgr = InputManager::createInputSystem(pl);
	  cout << _pInputMgr->inputSystemName() << " created." << endl;

	  // Create the event handler.
	  _pEventHdlr = new EventHandler(this);

	  // Create a simple keyboard
	  _pKeyboard = (Keyboard*)_pInputMgr->createInputObject( OISKeyboard, true );
	  _pKeyboard->setEventCallback( _pEventHdlr );

	  // Create the joystick manager.
	  _pJoystickMgr = new JoystickManager(_pInputMgr, _pEventHdlr);
	  if( !_pJoystickMgr->wasFFDetected() )
	  {
		cout << "No Force Feedback device detected." << endl;
		_nStatus = 1;
		return _nStatus;
	  }

	  // Create force feedback effect manager.
	  _pEffectMgr = new EffectManager(_pJoystickMgr, _nEffectUpdateFreq);

	  // Initialize the event handler.
	  _pEventHdlr->initialize(_pJoystickMgr, _pEffectMgr);

	  _bIsInitialized = true;

	  return _nStatus;
	}
コード例 #3
0
ファイル: fluid.cpp プロジェクト: yalcinozhabes/pythonJDFTx
	void process(ParamList& pl, Everything& e)
	{
		pl.get(e.eVars.fluidParams.vdwScale, 0.75, "scale");
	}
コード例 #4
0
ファイル: fluid.cpp プロジェクト: yalcinozhabes/pythonJDFTx
	void process(ParamList& pl, Everything& e)
	{	pl.get(e.cntrl.fluidGummel_nIterations, 10, "maxIterations");
		pl.get(e.cntrl.fluidGummel_Atol, 1e-5, "Atol");
	}
コード例 #5
0
void ofxGamepadHandler::updatePadList() {
#ifdef USE_OIS
	try {
		
		ParamList pl;
#if defined OIS_WIN32_PLATFORM
		if(hWnd == 0)
		{
			HWND windowHandle = FindWindow(NULL, L"gamepadExampleApp");
			std::ostringstream wnd;		
			wnd << (size_t)windowHandle;
						
			pl.insert(std::make_pair( std::string("WINDOW"), wnd.str() ));
		}
#endif
		InputManager* inputManager=InputManager::createInputSystem(pl);

		gamepadList padsOld=gamepads;
		std::vector<tempPad> sticks;
		//gamepads.clear();

		int numPads = inputManager->getNumberOfDevices(OISJoyStick);
		for( int i = 0; i < numPads; i++ ) {
			JoyStick* js = (JoyStick*)inputManager->createInputObject(OISJoyStick, true );
			sticks.push_back(tempPad(js));
		}

		std::vector<tempPad>::iterator sIt = sticks.begin();
		while(sIt!=sticks.end()) {
			gamepadList::iterator gIt = padsOld.begin();
			while(gIt!=padsOld.end()) {
				if((*sIt).stick->vendor() == (*gIt)->name) {
					ofPtr<ofxGamepadOIS> p = *gIt;
					p->updateJoystick((*sIt).stick);
					gamepadsNew.push_back(p);
					padsOld.erase(gIt);
					(*sIt).handled = true;
					break;
				}
				++gIt;
			}
			++sIt;
		}

		sIt = sticks.begin();
		while(sIt!=sticks.end()) {
			if(!(*sIt).handled)
				gamepadsNew.push_back(ofPtr<ofxGamepadOIS>(new ofxGamepadOIS((*sIt).stick)));
			++sIt;
		}

		lock();
		if(oisInputManager != NULL) {
			oisInputManager->destroyInputSystem(oisInputManager);
		}
		unlock();

		oisInputManager = inputManager;
	} catch(OIS::Exception &ex) {
		stringstream msg;
		msg << "\nException raised on joystick creation: " << ex.eText << std::endl;
		ofLog(OF_LOG_ERROR, msg.str());
	}
#elif defined(TARGET_LINUX)
	//check for joysticks
	ofFile file;
	for(int i=0; i<32; i++) {
		file.open("/dev/input/js"+ofToString(i));
		if(file.exists() && find(activeIDs.begin(), activeIDs.end(), i) == activeIDs.end()) {
			try {
				gamepadsNew.push_back(ofPtr<ofxGamepad>(new ofxGamepadLinux(file.getAbsolutePath())));
				activeIDs.push_back(i);
			} catch(std::exception& err) {
				ofLog(OF_LOG_ERROR, "could not create new gamepad");
			}
		}
	}
#else
	ofLog(OF_LOG_ERROR, "ofxGamepad says: sorry, looks like your system is not supported...");
#endif
}
コード例 #6
0
ファイル: fluid.cpp プロジェクト: yalcinozhabes/pythonJDFTx
	void process(ParamList& pl, Everything& e)
	{	pl.get(e.eVars.fluidInitialStateFilename, string(), "filename", true);
	}
コード例 #7
0
	void process(ParamList& pl, Everything& e)
	{	pl.get(e.coulombParams.ionMargin, 0., "margin", true);
		if(e.coulombParams.ionMargin < 1.) throw string("<margin> must be at least 1 bohr.");
	}
コード例 #8
0
void CommandMinimize::process(ParamList& pl, Everything& e)
{	MinimizeParams& mp = target(e);
	while(true)
	{	MinimizeParamsMember key;
		pl.get(key, MPM_Delim, mpmMap, "key");
		switch(key)
		{	case MPM_dirUpdateScheme: pl.get(mp.dirUpdateScheme, MinimizeParams::PolakRibiere, dirUpdateMap, "dirUpdateScheme", true); break;
			case MPM_linminMethod: pl.get(mp.linminMethod, MinimizeParams::Quad, linminMap, "linminMethod", true); break;
			case MPM_nIterations: pl.get(mp.nIterations, 0, "nIterations", true); break;
			case MPM_history: pl.get(mp.history, 0, "history", true); break;
			case MPM_knormThreshold: pl.get(mp.knormThreshold, 0., "knormThreshold", true); break;
			case MPM_energyDiffThreshold: pl.get(mp.energyDiffThreshold, 0., "energyDiffThreshold", true); break;
			case MPM_nEnergyDiff: pl.get(mp.nEnergyDiff, 0, "nEnergyDiff", true); break;
			case MPM_alphaTstart: pl.get(mp.alphaTstart, 0., "alphaTstart", true); break;
			case MPM_alphaTmin: pl.get(mp.alphaTmin, 0., "alphaTmin", true); break;
			case MPM_updateTestStepSize: pl.get(mp.updateTestStepSize, true, boolMap, "updateTestStepSize", true); break;
			case MPM_alphaTreduceFactor: pl.get(mp.alphaTreduceFactor, 0., "alphaTreduceFactor", true); break;
			case MPM_alphaTincreaseFactor: pl.get(mp.alphaTincreaseFactor, 0., "alphaTincreaseFactor", true); break;
			case MPM_nAlphaAdjustMax: pl.get(mp.nAlphaAdjustMax, 0, "nAlphaAdjustMax", true); break;
			case MPM_wolfeEnergy: pl.get(mp.wolfeEnergy, 0., "wolfeEnergy", true); break;
			case MPM_wolfeGradient: pl.get(mp.wolfeGradient, 0., "wolfeGradient", true); break;
			case MPM_fdTest: pl.get(mp.fdTest, false, boolMap, "fdTest", true); break;
			case MPM_Delim: return; //end of input
		}
	}
}
コード例 #9
0
void VCardFormatImpl::addTelephoneValue( VCARD::VCard *v, const PhoneNumber &p )
{
  if ( p.number().isEmpty() )
    return;

  ContentLine cl;
  cl.setName(EntityTypeToParamName(EntityTelephone));
  cl.setValue(new TelValue( p.number().utf8() ));

  ParamList params;
  if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) );
  if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) );
  if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) );
  if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) );
  if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) );
  if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) );
  if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) );
  if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) );
  if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) );
  if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) );
  if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) );
  if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) );
  if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) );
  if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) );
  cl.setParamList( params );

  v->add(cl);
}
コード例 #10
0
ファイル: result.cpp プロジェクト: joeedh/psa
void WriteResult(const std::string &base, Result &result, Config &config,
                 ParamList &params)
{
    const float fnorm = 2.f / sqrtf(result.npoints);
    const float rnorm = 1.f / sqrtf(2.f / (SQRT3 * result.npoints));
    
    // Statistics
    if (!params.GetString("convert").empty()) {
        std::string ext = params.GetString("convert");
        std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
        std::string dot = (ext[0] != '.') ? "." : "";
        result.points.Save(base+dot+ext);
    }
    if (params.GetBool("spatial") || params.GetBool("spectral") || params.GetBool("stats")) {
        static bool first = true;
        if (first) {
#ifdef PSA_HAS_CGAL
            printf("%-16s\tG-MD\tA-MD\tBOO\tE-Nyq.\tOsci.\n", "File");
#else
            printf("%-16s\tG-MD\tA-MD\tE-Nyq.\tOsci.\n", "File");
#endif
            first = false;
        }
        printf("%-16s", base.c_str());
        std::cout << std::fixed << std::setprecision(3) << std::setw(3);
#ifdef PSA_HAS_CGAL
        if (params.GetBool("spatial") || params.GetBool("stats"))
            std::cout << "\t" << result.stats.mindist * rnorm
                      << "\t" << result.stats.avgmindist * rnorm
                      << "\t" << result.stats.orientorder;
        else
            std::cout << "\t-\t-\t-";
#else
        if (params.GetBool("spatial") || params.GetBool("stats"))
            std::cout << "\t" << result.stats.mindist * rnorm
                      << "\t" << result.stats.avgmindist * rnorm;
        else
            std::cout << "\t-\t-";
#endif
        if (params.GetBool("spectral") || params.GetBool("stats"))
            std::cout << "\t" << result.stats.effnyquist * fnorm
                      << "\t" << result.stats.oscillations;
        else
            std::cout << "\t-\t-";
        std::cout << "\n";
    }
    // 1D
    if (params.GetBool("rp")) {
        std::string ylabel = (result.nsets > 1) ? "power" : "amplitude";
        std::string labels[2] = { "frequency", ylabel };
        float yrange[2] = { config.fymin, config.fymax };
        if (params.GetBool("raw"))
            result.rp.SaveTXT(base+"_rp.txt");
        else
            result.rp.SaveTEX(base+"_rp.tex", labels, yrange, 1.f, fnorm);
    }
    if (params.GetBool("rdf")) {
        std::string labels[2] = { "distance", "rdf" };
        float yrange[2] = { config.rymin, config.rymax };
        if (params.GetBool("raw"))
            result.rdf.SaveTXT(base+"_rdf.txt");
        else
            result.rdf.SaveTEX(base+"_rdf.tex", labels, yrange, 1.f, rnorm);
    }
    if (params.GetBool("ani")) {
        std::string labels[2] = { "frequency", "anisotropy" };
        float yrange[2] = { std::min(-1.25f * result.nsets, -12.5f),
                            std::max( 1.25f * result.nsets,  12.5f) };
        if (params.GetBool("raw"))
            result.ani.SaveTXT(base+"_ani.txt");
        else
            result.ani.SaveTEX(base+"_ani.tex", labels, yrange,
                               (result.nsets > 1 ? -result.nsets : 0), fnorm);
    }
    // 2D
    if (params.GetBool("pspectrum"))
        result.spectrum.Save(base+"_spec.png");
}
コード例 #11
0
ファイル: cm_imgui.cpp プロジェクト: colormotor/colormotor
void imgui( ParamList& plist, float cursorPos  )
{
    static bool opendemo=true;
        
    std::string id = plist.getPath() + "_ID";
    ImGui::PushID(id.c_str());
    //ImGui::BeginChild(id.c_str()); //"content");

    float cposyPrev = ImGui::GetCursorPosY();
    
    bool vis;
    if (plist.hasOption("hidden"))
        vis = ImGui::CollapsingHeader(plist.getName().c_str(), ImGuiTreeNodeFlags_AllowItemOverlap); //, NULL, true, true);
    else
        vis = ImGui::CollapsingHeader(plist.getName().c_str(), ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_DefaultOpen); //, NULL, true, true);
    
    float cposyNext = ImGui::GetCursorPosY();
    //ImGUi::SetCursorPosY(cposyPrev);
    //SameLine();
    
    //ImGui::PushItemWidth(-10);
    // in cm_imgui_app
    if (!plist.hasOption("child"))
    {
        extern ImFont * iconFont;
        ImGui::PushFont(iconFont);
        ImGui::PushID("btns");
        ImGui::SameLine(ImGui::GetWindowWidth()-100);

        if(ImGui::ButtonEx("l", ImVec2(0,0), ImGuiButtonFlags_PressedOnClick)) // Hack default onRelease with Button does not seem to work
        {
            std::string path;
            if(openFileDialog(path,"xml"))
                plist.loadXml(path.c_str());
        }
        //ImGui::NextColumn();
        ImGui::SameLine();
        if(ImGui::ButtonEx("s",ImVec2(0,0), ImGuiButtonFlags_PressedOnClick))//, ImVec2(100,20)))
        {
            std::string path;
            if(saveFileDialog(path,"xml"))
                plist.saveXml(path.c_str());
        }
        ImGui::PopID();
        ImGui::PopFont();
    }
    //ImGui::PopItemWidth();
    
    if(!vis)
    {
        //ImGui::EndChild();
        ImGui::PopID();
        return;
    }
    
    
    //if(!)
    //ImGui::OpenNextNode(true);
    //if(!ImGui::TreeNode(plist.getName().c_str()))
    
    for( int i = 0; i < plist.getNumParams(); i++ )
    {
        Param * p = plist.getParam(i);
        if(p->hasOption("h"))
            continue;
        if(p->hasOption("sameline"))
            ImGui::SameLine();
        
        imgui(p);
    }
    
    for( int i = 0; i < plist.getNumChildren(); i++ )
    {
        ImGui::Indent();
        imgui(*plist.getChild(i), cursorPos+10.0 );
        ImGui::Unindent();
    }
    
    //ImGui::TreePop();
    ImGui::PopID();
    //ImGui::EndChild();
}