当前位置: 首页>>代码示例>>C++>>正文


C++ Configuration类代码示例

本文整理汇总了C++中Configuration的典型用法代码示例。如果您正苦于以下问题:C++ Configuration类的具体用法?C++ Configuration怎么用?C++ Configuration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IQRouterBase

IQRouterBaseline::IQRouterBaseline( const Configuration& config,
                                    Module *parent, const string & name, int id,
                                    int inputs, int outputs )
    : IQRouterBase( config, parent, name, id, inputs, outputs )
{
    string alloc_type;
    string arb_type;
    int iters;

    // Alloc allocators
    config.GetStr( "vc_allocator", alloc_type );
    config.GetStr( "vc_alloc_arb_type", arb_type );
    iters = config.GetInt( "vc_alloc_iters" );
    if(iters == 0) iters = config.GetInt("alloc_iters");
    _vc_allocator = Allocator::NewAllocator( this, "vc_allocator",
                    alloc_type,
                    _vcs*_inputs,
                    _vcs*_outputs,
                    iters, arb_type );

    if ( !_vc_allocator ) {
        cout << "ERROR: Unknown vc_allocator type " << alloc_type << endl;
        exit(-1);
    }

    config.GetStr( "sw_allocator", alloc_type );
    config.GetStr( "sw_alloc_arb_type", arb_type );
    iters = config.GetInt("sw_alloc_iters");
    if(iters == 0) iters = config.GetInt("alloc_iters");
    _sw_allocator = Allocator::NewAllocator( this, "sw_allocator",
                    alloc_type,
                    _inputs*_input_speedup,
                    _outputs*_output_speedup,
                    iters, arb_type );

    if ( !_sw_allocator ) {
        cout << "ERROR: Unknown sw_allocator type " << alloc_type << endl;
        exit(-1);
    }

    _speculative = config.GetInt( "speculative" ) ;

    if ( _speculative >= 2 ) {

        string filter_spec_grants;
        config.GetStr("filter_spec_grants", filter_spec_grants);
        if(filter_spec_grants == "any_nonspec_gnts") {
            _filter_spec_grants = 0;
        } else if(filter_spec_grants == "confl_nonspec_reqs") {
            _filter_spec_grants = 1;
        } else if(filter_spec_grants == "confl_nonspec_gnts") {
            _filter_spec_grants = 2;
        } else assert(false);

        _spec_sw_allocator = Allocator::NewAllocator( this, "spec_sw_allocator",
                             alloc_type,
                             _inputs*_input_speedup,
                             _outputs*_output_speedup,
                             iters, arb_type );
        if ( !_spec_sw_allocator ) {
            cout << "ERROR: Unknown sw_allocator type " << alloc_type << endl;
            exit(-1);
        }

    }

    _sw_rr_offset.resize(_inputs*_input_speedup);

}
开发者ID:pras710,项目名称:booksim3d,代码行数:69,代码来源:iq_router_baseline.cpp

示例2: saveBooleanToConfigFile

bool ConfigurationHolder::saveBooleanToConfigFile(const Configuration & configObject) const
{
	const WCHAR *boolValue = configObject.isTrue() ? L"1" : L"0";
	BOOL ret = WritePrivateProfileString(CONFIG_FILE_SECTION_NAME, configObject.getName(), boolValue, configPath);
	return ret == TRUE;
}
开发者ID:JohannesHei,项目名称:Scylla,代码行数:6,代码来源:ConfigurationHolder.cpp

示例3: testGetLocationUpdateInterval

void testGetLocationUpdateInterval(Configuration& configuration, Logger& logger) {
	logger.info("Testing Configuration::getLocationUpdateInterval() method");

	EXPECT_EQ(20, configuration.getLocationUpdateInterval());
}
开发者ID:mspublic,项目名称:openair4G-mirror,代码行数:5,代码来源:test_configuration.hpp

示例4: XmlConfiguration

/**
 * Get the default backend from config.xml, use UPnP to find it.
 *
 * Sets a string if there any connection problems
 */
bool MythContextPrivate::DefaultUPnP(QString &error)
{
    Configuration *pConfig = new XmlConfiguration("config.xml");
    QString            loc = "MCP::DefaultUPnP() - ";
    QString  localHostName = pConfig->GetValue(kDefaultBE + "LocalHostName", "");
    QString            PIN = pConfig->GetValue(kDefaultPIN, "");
    QString            USN = pConfig->GetValue(kDefaultUSN, "");

    delete pConfig;

    if (USN.isEmpty())
    {
        VERBOSE(VB_UPNP, loc + "No default UPnP backend");
        return false;
    }

    VERBOSE(VB_UPNP, loc + "config.xml has default " +
            QString("PIN '%1' and host USN: %2")
            .arg(PIN).arg(USN));

    // ----------------------------------------------------------------------

    SSDP::Instance()->PerformSearch( gBackendURI );

    // ----------------------------------------------------------------------
    // We need to give the server time to respond...
    // ----------------------------------------------------------------------

    DeviceLocation *pDevLoc = NULL;
    QTime           timer;

    for (timer.start(); timer.elapsed() < 5000; usleep(25000))
    {
        pDevLoc = SSDP::Instance()->Find( gBackendURI, USN );

        if (pDevLoc)
            break;

        putchar('.');
    }
    putchar('\n');

    // ----------------------------------------------------------------------

    if (!pDevLoc)
    {
        error = "Cannot find default UPnP backend";
        return false;
    }

    if (UPnPconnect(pDevLoc, PIN))
    {
        if (localHostName.length())
        {
            m_DBparams.localHostName = localHostName;
            m_DBparams.localEnabled  = true;
            gCoreContext->GetDB()->SetDatabaseParams(m_DBparams);
        }

        return true;
    }

    error = "Cannot connect to default backend via UPnP. Wrong saved PIN?";
    return false;
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:70,代码来源:mythcontext.cpp

示例5: saveStringToConfigFile

bool ConfigurationHolder::saveStringToConfigFile(const Configuration & configObject) const
{
	BOOL ret = WritePrivateProfileString(CONFIG_FILE_SECTION_NAME, configObject.getName(), configObject.getString(), configPath);
	return ret == TRUE;
}
开发者ID:JohannesHei,项目名称:Scylla,代码行数:5,代码来源:ConfigurationHolder.cpp

示例6: KDialog

AssistantDialog::AssistantDialog( const QStringList &playableFileTypes, bool saveSupported,
                                  Collections::CollectionLocationDelegate::OperationType operation,
                                  const QString &destCollectionName,
                                  const Configuration &prevConfiguration,
                                  QWidget *parent )
    : KDialog( parent, Qt::Dialog )
    , m_configuration( JUST_COPY )
    , m_save( false )
    , m_playableFileTypes( playableFileTypes )
{
    DEBUG_BLOCK
    Q_UNUSED( destCollectionName )  // keep it in signature, may be useful in future

    QWidget *uiBase = new QWidget( this );
    setMainWidget( uiBase);
    ui.setupUi( uiBase );
    setModal( true );
    setWindowTitle( i18n( "Transcode Tracks" ) );
    setMinimumSize( 590, 340 );
    setMaximumWidth( 590 );
    setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );

    setButtons( Ok|Cancel );
    button( Ok )->setText( i18n( "Transc&ode" ) );
    button( Ok )->setEnabled( false );

    QString explanatoryText;
    KIcon justCopyIcon;
    QString justCopyText;
    QString justCopyDescription;
    switch( operation )
    {
        case Collections::CollectionLocationDelegate::Copy:
            explanatoryText = i18n(
                "While copying, you can choose to transcode your music files into another "
                "format with an encoder (codec). This can be done to save space or to "
                "make your files readable by a portable music player or a particular "
                "software program." );
            justCopyIcon = KIcon( "edit-copy" );
            justCopyText = i18n( "&Copy" );
            justCopyDescription = i18n( "Just copy the tracks without transcoding them." );
            break;
        case Collections::CollectionLocationDelegate::Move:
            explanatoryText = i18n(
                "While moving, you can choose to transcode your music files into another "
                "format with an encoder (codec). This can be done to save space or to "
                "make your files readable by a portable music player or a particular "
                "software program. Only successfully transcoded files will be removed "
                "from their original location." );
            justCopyIcon = KIcon( "go-jump" ); // Dolphin uses this icon for "move"
            justCopyText = i18n( "&Move" );
            justCopyDescription = i18n( "Just move the tracks without transcoding them." );
            break;
    }
    ui.explanatoryTextLabel->setText( explanatoryText );

    ui.justCopyButton->setIcon( justCopyIcon );
    ui.justCopyButton->setText( justCopyText );
    ui.justCopyButton->setDescription( justCopyDescription );
    ui.justCopyButton->setMinimumHeight( ui.justCopyButton->iconSize().height() + 2*10 ); //we make room for the pretty icon
    connect( ui.justCopyButton, SIGNAL(clicked()),
             this, SLOT(onJustCopyClicked()) );

    //Let's set up the codecs page...
    populateFormatList();
    connect( ui.formatListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
             this, SLOT(onFormatSelect(QListWidgetItem*)) );

    ui.formatIconLabel->hide();
    ui.formatNameLabel->hide();
    connect( button( Ok ), SIGNAL(clicked()),
             this, SLOT(onTranscodeClicked()) );

    ui.rememberCheckBox->setChecked( m_save );
    ui.rememberCheckBox->setEnabled( saveSupported );
    connect( ui.rememberCheckBox, SIGNAL(toggled(bool)),
             this, SLOT(onRememberToggled(bool)) );

    switch( prevConfiguration.trackSelection() ) //restore the previously selected TrackSelection radio button
    {
        case Configuration::TranscodeUnlessSameType:
            ui.transcodeUnlessSameTypeRadioButton->setChecked( true );
            break;
        case Configuration::TranscodeOnlyIfNeeded:
            ui.transcodeOnlyIfNeededRadioButton->setChecked( true );
            break;
        case Configuration::TranscodeAll:
            ui.transcodeAllRadioButton->setChecked( true );
    }

    ui.transcodeAllRadioButton->setEnabled( false );
    ui.transcodeUnlessSameTypeRadioButton->setEnabled( false );
    ui.transcodeOnlyIfNeededRadioButton->setEnabled( false );
}
开发者ID:darthcodus,项目名称:Amarok,代码行数:94,代码来源:TranscodingAssistantDialog.cpp

示例7: getLogDir

string Logging::getLogDir(const Configuration& conf)
{
  return conf.get("log_dir", "");
}
开发者ID:adegtiar,项目名称:sceem,代码行数:4,代码来源:logging.cpp

示例8: main

int main(int argc, char** argv)
{
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  Configurator configurator;

  // The following options are executable specific (e.g., since we
  // only have one instance of libprocess per execution, we only want
  // to advertise the port and ip option once, here).
  configurator.addOption<int>("port", 'p', "Port to listen on", 5050);
  configurator.addOption<string>("ip", "IP address to listen on");
#ifdef MESOS_WEBUI
  configurator.addOption<int>("webui_port", "Web UI port", 8080);
#endif
  configurator.addOption<string>(
      "master",
      'm',
      "May be one of:\n"
      "  host:port\n"
      "  zk://host1:port1,host2:port2,.../path\n"
      "  zk://username:[email protected]:port1,host2:port2,.../path\n"
      "  file://path/to/file (where file contains one of the above)");

  if (argc == 2 && string("--help") == argv[1]) {
    usage(argv[0], configurator);
    exit(1);
  }

  Configuration conf;
  try {
    conf = configurator.load(argc, argv);
  } catch (const ConfigurationException& e) {
    cerr << "Configuration error: " << e.what() << endl;
    exit(1);
  }

  // Initialize libprocess.
  process::initialize();

  if (!conf.contains("master")) {
    cerr << "Missing required option --master (-m)" << endl;
    usage(argv[0], configurator);
    exit(1);
  }

  // TODO(vinod): Parse 'master' when we add ZooKeeper support.
  UPID master(conf["master"]);

  if (!master) {
    cerr << "Could not parse --master=" << conf["master"] << endl;
    usage(argv[0], configurator);
    exit(1);
  }

  if (!conf.contains("name")) {
    // TODO(benh): Need to add '--name' as an option.
    cerr << "Missing --name (-n)" << endl;
    usage(argv[0], configurator);
    exit(1);
  }

  LOG(INFO) << "Submitting scheduler ...";

  Protocol<SubmitSchedulerRequest, SubmitSchedulerResponse> submit;

  SubmitSchedulerRequest request;
  request.set_name(conf["name"]);

  Future<SubmitSchedulerResponse> future = submit(master, request);

  future.await(5.0);

  if (future.isReady()) {
    if (future.get().okay()) {
      cout << "Scheduler submitted successfully" << endl;
    } else {
      cout << "Failed to submit scheduler" << endl;
    }
  } else {
    cout << "Timed out waiting for response from submitting scheduler" << endl;
  }

  return 0;
}
开发者ID:vicever,项目名称:mesos,代码行数:84,代码来源:main.cpp

示例9: TRACEI

//================================================================================================
//
//  Load()
//
//    - Called by Main_OnInitDialog()
//
/// <summary>
///   Attempts to load the config-file.  Returns true if successful, false if not
/// </summary>
/// <remarks>
///   If we're unsuccessful, the caller will assume this is the first time we've run the program
///   and will run through the startup-wizard.
/// </remarks>
//
bool Configuration::Load()
{
    TRACEI("[Configuration] [Load]  > Entering routine.");

    TiXmlDocument doc;

    const path pb=path::base_dir()/_T("peerblock.conf");
    const path oldpb=path::base_dir()/_T("peerblock.conf.bak");
    const path pg2=path::base_dir()/_T("pg2.conf");

    vector<path> files;
    files.push_back(pb);
    files.push_back(oldpb);
    files.push_back(pg2);

    bool loaded = false;
    bool isDirty = false;

    for(vector<path>::iterator itr = files.begin(); itr != files.end() && !loaded; ++itr)
    {
        {
            HANDLE fp = NULL;
            HANDLE map = NULL;
            const void *view = NULL;
            if (!LoadFile((*itr).file_str().c_str(), &fp, &map, &view))	// first try to find a PeerBlock file
            {
                tstring strBuf = boost::str(tformat(_T("[Configuration] [Load]    WARNING:  Unable to load configuration file [%1%]")) %
                                            (*itr).file_str().c_str() );
                TRACEBUFW(strBuf);
                continue;
            }

            tstring strBuf = boost::str(tformat(_T("[Configuration] [Load]    Loaded configuration file [%1%]")) %
                                        (*itr).file_str().c_str() );
            TRACEBUFI(strBuf);

            boost::shared_ptr<void> fp_safe(fp, CloseHandle);
            boost::shared_ptr<void> map_safe(map, CloseHandle);
            boost::shared_ptr<const void> view_safe(view, UnmapViewOfFile);

            doc.Parse((const char*)view);

            if(doc.Error())
            {
                TRACEE("[Configuration] [Load]  * ERROR:  Can't parse xml document");
                tstring strBuf = boost::str(tformat(_T("[Configuration] [Load]  * - Error: [%1%] (\"%2%\") at row:[%3%] col:[%4%]")) %
                                            doc.ErrorId() % doc.ErrorDesc() % doc.ErrorRow() % doc.ErrorCol() );
                TRACEBUFE(strBuf);

                // copy over to .failed
                path failedFile;
                failedFile = itr->file_str();
                failedFile = failedFile.file_str() + L".failed";
                path::copy(*itr, failedFile, true);
                strBuf = boost::str(tformat(_T("[Configuration] [Load]    - Copied failed-parsing config-file to: [%1%]")) % failedFile.file_str() );
                TRACEBUFE(strBuf);
                continue;
            }
        }

        if (*itr == pb)
        {
            TRACEI("[Configuration] [Load]    found peerblock configuration file");
        }
        else if (*itr == oldpb)
        {
            TRACEW("[Configuration] [Load]    using last-known-good configuration file");
            MessageBox(NULL, IDS_CONFERRTEXT, IDS_CONFERR, MB_ICONWARNING|MB_OK);
            g_config.Save(_T("peerblock.conf"));	// save restored config to regular file
        }
        else if (*itr == pg2)
        {
            TRACEI("[Configuration] [Load]    found old-style pg2 configuration file");
        }
        else	// can't find anything, return false so caller can run the startup-wizard
        {
            TRACEW("[Configuration] [Load]    WARNING:  No configuration file found.");
            return false;
        }

        loaded = true;
    }

    if (!loaded)
    {
        // can't find anything, return false so caller can run the startup-wizard
//.........这里部分代码省略.........
开发者ID:hskang113,项目名称:peerblock,代码行数:101,代码来源:configuration.cpp

示例10: init

boolean StrategySettingsClass::init(){

	Configuration cfg;

	if (cfg.loadFromFile(STRATEGY_CONFIG_FILE) == FILE_VALID){

		valid = true;

		//Load track data
		trackData.trackLenght = cfg.getProperty(TRACK_LENGHT).asInt();
		trackData.trackFinish = cfg.getProperty(TRACK_FINISH).asInt();

		trackData.raceLaps = cfg.getProperty(RACE_LAPS).asInt();
		trackData.raceTime = cfg.getProperty(RACE_TIME).asInt();

		trackData.firstLapTime = cfg.getProperty(T_FIRST_LAP).asInt();
		trackData.generalLapTime = cfg.getProperty(T_LAP).asInt();
		trackData.lastLapTime = cfg.getProperty(T_LAST_LAP).asInt();

		debugTrackSettings();

		/*
		//Load first lap
		if (trackData.firstLapTime != 0){
			loadLapProfile(STRATEGY_FIRSTLAP_FILE, firstLap, trackData.trackLenght + 1);
			consoleForm.println(F("First lap profile OK"));
			Log.i(STRAT_TAG) << F("First lap profile OK") << Endl;
		}
		else{
			consoleForm.println(F("First lap profile SKIP"));
			Log.w(STRAT_TAG) << F("First lap profile SKIP") << Endl;
			valid = false;
		}

		//Load general lap
		if (trackData.generalLapTime != 0){
			loadLapProfile(STRATEGY_FIRSTLAP_FILE, generalLap, trackData.trackLenght + 1);
			consoleForm.println(F("General lap profile OK"));
			Log.i(STRAT_TAG) << F("General lap profile OK") << Endl;
		}
		else{
			consoleForm.println(F("General lap profile SKIP"));
			Log.w(STRAT_TAG) << F("General lap profile SKIP") << Endl;
			valid = false;
		}

		//Load last lap
		if (trackData.lastLapTime != 0){
			loadLapProfile(STRATEGY_FIRSTLAP_FILE, lastLap, trackData.trackLenght + 1);
			consoleForm.println(F("Last lap profile OK"));
			Log.i(STRAT_TAG) << F("Last lap profile OK") << Endl;
		}
		else{
			consoleForm.println(F("Last lap profile SKIP"));
			Log.w(STRAT_TAG) << F("Last lap profile SKIP") << Endl;
			valid = false;
		}
		*/

		if (loadLapProfile()){
			consoleForm.println(F("Laps profiles loaded!"));
			Log.i(STRAT_TAG) << F("Laps profiles loaded!") << Endl;
		}
		else{
			consoleForm.println(F("Failed to load laps profiles!"));
			Log.e(STRAT_TAG) << F("Failed to load laps profiles!") << Endl;
			valid = false;
		}
		
	}
	else{
		consoleForm.println(cfg.getErrorMsg());
		Log.e(STRAT_TAG) << cfg.getErrorMsg() << Endl;

		valid = false;
	}

	return valid;
}
开发者ID:DavideMalvezzi,项目名称:EscorpioEvo16-Dashboard,代码行数:79,代码来源:StrategySettings.cpp

示例11: main

//The Main function of program
int main(int argc, char *argv[])
{
#ifdef _DEBUG
//Handle the system signal.
	SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE);
#endif

	if (argc > 0)
	{
		std::shared_ptr<wchar_t> wPath(new wchar_t[MAX_PATH]());
	//Path initialization and Winsock initialization.
		MultiByteToWideChar(CP_ACP, NULL, argv[0], MBSTOWCS_NULLTERMINATE, wPath.get(), MAX_PATH);
		if (FileInit(wPath.get()) == EXIT_FAILURE)
			return EXIT_FAILURE;
		wPath.reset();

	//Windows Firewall Test in first start.
		if (argc > 1 && strlen(argv[1U]) == strlen("--FirstStart") && memcmp(argv[1], ("--FirstStart"), strlen("--FirstStart")) == 0)
		{
			if (FirewallTest(AF_INET6) == EXIT_FAILURE && FirewallTest(AF_INET) == EXIT_FAILURE)
			{
				PrintError(WINSOCK_ERROR, L"Windows Firewall Test error", NULL, nullptr, NULL);

				WSACleanup();
				return EXIT_FAILURE;
			}
			else {
				return EXIT_SUCCESS;
			}
		}
	}
	else {
		return EXIT_FAILURE;
	}

//Read configuration file and WinPcap initialization.
	if (Parameter.ReadParameter() == EXIT_FAILURE)
	{
		WSACleanup();
		return EXIT_FAILURE;
	}
	std::thread CaptureInitializationThread(CaptureInit);
	CaptureInitializationThread.detach();

//Get Localhost DNS PTR Records.
	std::thread IPv6LocalAddressThread(LocalAddressToPTR, AF_INET6);
	std::thread IPv4LocalAddressThread(LocalAddressToPTR, AF_INET);
	IPv6LocalAddressThread.detach();
	IPv4LocalAddressThread.detach();

//DNSCurve initialization
	if (Parameter.DNSCurve && DNSCurveParameter.Encryption)
	{
		randombytes_set_implementation(&randombytes_salsa20_implementation);
		DNSCurveInit();
	}
	
//Read IPFilter, start DNS Cache monitor(Timer type) and read Hosts.
	if (Parameter.FileRefreshTime > 0)
	{
		if (Parameter.OperationMode == LISTEN_CUSTOMMODE)
		{
			std::thread IPFilterThread(&Configuration::ReadIPFilter, std::ref(Parameter));
			IPFilterThread.detach();
		}

		if (Parameter.CacheType != 0)
		{
			std::thread DNSCacheTimerThread(DNSCacheTimerMonitor, Parameter.CacheType);
			DNSCacheTimerThread.detach();
		}

		std::thread HostsThread(&Configuration::ReadHosts, std::ref(Parameter));
		HostsThread.detach();
	}

//Service initialization and start service.
	SERVICE_TABLE_ENTRYW ServiceTable[] = {{LOCAL_SERVICENAME, (LPSERVICE_MAIN_FUNCTIONW)ServiceMain}, {nullptr, NULL}};
	if (!StartServiceCtrlDispatcherW(ServiceTable))
	{
		PrintError(SYSTEM_ERROR, L"Service start error", GetLastError(), nullptr, NULL);

		WSACleanup();
		return EXIT_FAILURE;
	}

	WSACleanup();
	return EXIT_SUCCESS;
}
开发者ID:Guimashi,项目名称:pcap_dnsproxy,代码行数:90,代码来源:Main.cpp

示例12: g

/**
 * Device signals that a specific property changed and reports the new value
 */
int CoreCallback::OnPropertyChanged(const MM::Device* device, const char* propName, const char* value)
{
   if (core_->externalCallback_) 
   {
      MMThreadGuard g(*pValueChangeLock_);
      char label[MM::MaxStrLength];
      device->GetLabel(label);
	  bool readOnly;
	  device->GetPropertyReadOnly(propName, readOnly);
	  const PropertySetting* ps = new PropertySetting(label, propName, value, readOnly);
      core_->stateCache_.addSetting(*ps);
      core_->externalCallback_->onPropertyChanged(label, propName, value);
      
      // find all configs that contain this property and callback to indicate 
      // that the config group changed
      // TODO: assess whether performace is better by maintaining a map tying 
      // property to configurations
  /*
      using namespace std;
      vector<string> configGroups = core_->getAvailableConfigGroups ();
      for (vector<string>::iterator it = configGroups.begin(); 
            it!=configGroups.end(); ++it) 
      {
         vector<string> configs = core_->getAvailableConfigs((*it).c_str());
         bool found = false;
         for (vector<string>::iterator itc = configs.begin();
               itc != configs.end() && !found; itc++) 
         {
            Configuration config = core_->getConfigData((*it).c_str(), (*itc).c_str());
            if (config.isPropertyIncluded(label, propName)) {
               found = true;
               // If we are part of this configuration, notify that it was changed
               // get the new config from cache rather than query the hardware
               string currentConfig = core_->getCurrentConfigFromCache( (*it).c_str() );
               OnConfigGroupChanged((*it).c_str(), currentConfig.c_str());
            }
         }
      }
      */
          

      // Check if pixel size was potentially affected.  If so, update from cache
      vector<string> pixelSizeConfigs = core_->getAvailablePixelSizeConfigs();
      bool found = false;
      for (vector<string>::iterator itpsc = pixelSizeConfigs.begin();
            itpsc != pixelSizeConfigs.end() && !found; itpsc++) 
      {
         Configuration pixelSizeConfig = core_->getPixelSizeConfigData( (*itpsc).c_str());
         if (pixelSizeConfig.isPropertyIncluded(label, propName)) {
            found = true;
            double pixSizeUm;
            try {
               // update pixel size from cache
               pixSizeUm = core_->getPixelSizeUm(true);
            }
            catch (CMMError ) {
               pixSizeUm = 0.0;
            }
            OnPixelSizeChanged(pixSizeUm);
         }
      }
   }

   return DEVICE_OK;
}
开发者ID:erisir,项目名称:Micro-Manager,代码行数:68,代码来源:CoreCallback.cpp

示例13: Network

CMeshX2::CMeshX2( const Configuration &config ) 
  : Network( config ) 
{

  _subMesh[0] = new CMesh( config );
  _subMesh[1] = new CMesh( config );

  int k = config.GetInt( "k" ) ;
  int n = config.GetInt( "n" ) ;
  int c = config.GetInt( "c" ) ;


  gK = _k = k ;
  gN = _n = n ;
  gC = _c = c ;
  
  _sources  = _c * powi( _k, _n); // Source nodes in network
  _dests    = _c * powi( _k, _n); // Destination nodes in network
  _size     = powi( _k, _n);      // Number of routers in network
  _channels = 0;
  
  _f_read_history = new int[_sources];
  _c_read_history = new int[_dests];
  
  for (int i = 0; i < _size; i++) {
    _f_read_history[i] = 0;
    _c_read_history[i] = 0;
  }

  _subNetAssignment[Flit::READ_REQUEST] 
    = config.GetInt( "read_request_subnet" );
  assert( _subNetAssignment[Flit::READ_REQUEST] == 0 ||
	  _subNetAssignment[Flit::READ_REQUEST] == 1);

  _subNetAssignment[Flit::READ_REPLY] 
    = config.GetInt( "read_reply_subnet" );
  assert( _subNetAssignment[Flit::READ_REPLY] == 0 ||
	  _subNetAssignment[Flit::READ_REPLY] == 1 );

  _subNetAssignment[Flit::WRITE_REQUEST] 
    = config.GetInt( "write_request_subnet" );
  assert( _subNetAssignment[Flit::WRITE_REQUEST] == 0 ||
	  _subNetAssignment[Flit::WRITE_REQUEST] == 1);

  _subNetAssignment[Flit::WRITE_REPLY]
    = config.GetInt( "write_reply_subnet" );
  assert( _subNetAssignment[Flit::WRITE_REPLY] == 0 ||
	  _subNetAssignment[Flit::WRITE_REPLY] == 1 );
  
  int cookie_0 = 0;
  int cookie_1 = 0;
  if ( _subNetAssignment[Flit::WRITE_REQUEST] == 0 ||
       _subNetAssignment[Flit::READ_REPLY]    == 0 )
    cookie_0 = 1;
  
  if ( _subNetAssignment[Flit::WRITE_REQUEST] == 1 ||
       _subNetAssignment[Flit::READ_REPLY]    == 1 )
    cookie_1 = 1;
  assert( cookie_0 == 1 || cookie_1 == 1 );
  _subMesh[0]->SetChannelCookie(cookie_0);
  _subMesh[1]->SetChannelCookie(cookie_1);

}
开发者ID:pranamibhatt,项目名称:booksim,代码行数:63,代码来源:cmeshx2.cpp

示例14: DisplayMenu

int Menu::DisplayMenu()
{
	Display display;
	Configuration config;
	Functions func;

	string PanelHeaders[8] = {"      MENU      ", "     DISPLAY    ", "  SERVER LIST   ", "  SET USERNAME  ", "    SETTINGS    ", "      ABOUT     ", "      QUIT      ", "      NEWS      "};
	string MenuList[MaxNo_Menu] = {"  Server List ", " Set Username ",  "   Settings   ", "     About    ", "     Quit     "};
	int ypos[MaxNo_Menu] = { 12, 14, 16, 18, 20};
    int xpos = 5;

	config.SetColour(MenuTitleColour);
	config.SetXYCoord(4, 10); cout << PanelHeaders[0];
	
	config.SetColour(MenuTitleColour);
	config.SetXYCoord(42, 10); cout << PanelHeaders[1];

	// Show Menu

	int i;
	config.SetColour(StandardColour); 
	for (i=0; i< MaxNo_Menu; ++i)
	{
		config.SetXYCoord(xpos, ypos[i] );
		config.SetColour(StandardColour); 
		cout << MenuList[i];
	}
	// Enable Menu
	i = 0;
	while(1)
	{
		config.SetXYCoord(xpos, ypos[i]);
		config.SetColour(HoverColour);

		cout << MenuList[i];
		switch( _getch() )
		{
			case 72: if(i>0) 
				{
       				config.SetXYCoord(xpos,ypos[i] );
					config.SetColour(StandardColour); // Standard Going Down
					cout << MenuList[i];
					i--;
				}
				break;
			case 80: if(i< MaxNo_Menu-1 )
				{
       				config.SetXYCoord(xpos,ypos[i] );
					config.SetColour(StandardColour); // Standard Going Up
					cout << MenuList[i];
					i++;
				}
				break;
			case 13: 
				if(i==0) 
				{  
					func.ServerBrowser(PanelHeaders);
				}
				if(i==1) 
				{  					
					func.SetUsername(PanelHeaders);
				}
				if(i==2) 
				{					
					func.Settings(PanelHeaders);					
				}
				if(i==3) 
				{		
					func.DisplayAbout(PanelHeaders);
				}
				if(i==4) 
				{  // Exit					
					display.RemoveText();
					config.SetColour(MenuTitleColour), config.SetXYCoord(42, 10), cout << PanelHeaders[6];
					config.SetColour(StandardColour);   

					char Input;					
					config.SetXYCoord(34,12); cout << "Are you sure you want to exit? [Y/N]: ";
					cin >> Input; 

					if (toupper(Input) == 'N')
					{
						break;
					}
					else if (toupper(Input) == 'Y')
					{
						config.SetXYCoord(34,15); return 0;						
					}
					else if (Input == ' ' || Input != toupper('Y') || Input != toupper('N'))
					{
						while(Input == ' ' || Input != toupper('Y') || Input != toupper('N'))
						{	
							config.SetColour(ErrorColour);
							config.SetXYCoord(34,13),cout << "Error: Please Enter [Y/N]: ";
							config.SetColour(StandardColour), cin >> Input;
							if (toupper(Input) == 'N')
							{
								break;
							}
							else if (toupper(Input) == 'Y')
//.........这里部分代码省略.........
开发者ID:Craftein,项目名称:learningcurves,代码行数:101,代码来源:Menu.cpp

示例15:

Configuration::Configuration()
{
	static Configuration config;
	config.readConfig();
}
开发者ID:ryanfzy,项目名称:myeditor,代码行数:5,代码来源:ConfigReader.cpp


注:本文中的Configuration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。