예제 #1
0
void DepotSerializer::createDependentArticles(Article::ArticlePtr &article, const YAML::Node &article_node, std::map<int, YAML::Node> &all_articles)
{
  if (article_node["dependents"])
  {
    for (const auto & dependent_article_id : article_node["dependents"])
    {
      const auto dependentArticleId = dependent_article_id.as<int>();
      const auto & dependent_article_node = all_articles.at(dependentArticleId);
      auto dependent_article = article->createDependentArticle(dependent_article_node["name"].as< std::string>(), dependent_article_node["unit"].as<std::string>());
      deserializationArticles[dependentArticleId] = dependent_article;
      createDependentArticles(dependent_article, dependent_article_node, all_articles);
      all_articles.erase(dependent_article_id.as<int>());
    }
  }
}
예제 #2
0
void PNSearch::Search(const PNSParams& pns_params, PNSResult* pns_result) {
  if (pns_tree_) {
    Delete(pns_tree_);
    pns_tree_ = nullptr;
  }
  pns_tree_ = new PNSNode;

  Pns(pns_params, pns_tree_);
  pns_result->pns_tree = pns_tree_;
  pns_result->tree_size = pns_tree_->tree_size;

  for (PNSNode* pns_node : pns_tree_->children) {
    // This is from the current playing side perspective.
    double score;
    int result;
    if (pns_node->proof == 0) {
      score = DBL_MAX;
      result = -WIN;
    } else {
      score = static_cast<double>(pns_node->disproof) / pns_node->proof;
      if (pns_node->proof == INF_NODES && pns_node->disproof == 0) {
        result = WIN;
      } else if (pns_node->proof == INF_NODES &&
                 pns_node->disproof == INF_NODES) {
        result = DRAW;
      } else {
        result = UNKNOWN;
      }
    }
    pns_result->ordered_moves.push_back(
        {pns_node->move, score, pns_node->tree_size, result});
  }
  sort(pns_result->ordered_moves.begin(), pns_result->ordered_moves.end(),
       [](const PNSResult::MoveStat& a, const PNSResult::MoveStat& b) {
         return a.score < b.score;
       });
  // Print the ordered moves.
  if (!pns_params.quiet) {
    std::cout << "# Move, score, tree_size:" << std::endl;
    for (const auto& move_stat : pns_result->ordered_moves) {
      static std::map<int, std::string> result_map = {
          {WIN, "WIN"}, {-WIN, "LOSS"}, {DRAW, "DRAW"}, {UNKNOWN, "UNKNOWN"}};
      std::cout << "# " << move_stat.move.str() << ", " << move_stat.score
                << ", " << move_stat.tree_size << ", "
                << result_map.at(move_stat.result) << std::endl;
    }
  }
}
예제 #3
0
std::string dmiBitFieldToStr(size_t bitField,
                             const std::map<uint8_t, std::string>& table) {
  std::string result;

  for (uint8_t i = 0; i < table.size(); i++) {
    if (1 << i & bitField) {
      result = result + table.at(i) + ' ';
    }
  }

  if (!result.empty()) {
    result.pop_back();
  }

  return result;
}
/** Inform Leafy of the number of fires. 
 For each config::leafy_mood_change_rate increment of fires, the
 mood of Leafy changes.
 @param number_of_fires 
 
 TODO: change to receive the vector of fires and make mood
 a function of the distance from fires.
 */
void Leafy::inform_fires_and_set_mood(const unsigned number_of_fires)
{
    Leafymood mood = static_cast<Leafymood>(number_of_fires / config::leafy_mood_change_rate);
    if (mood>skeleton) mood = skeleton;
    if(mood!=_mood)
    try {
        _mood = mood;
        set_texture(leafy_mood_filenames.at(mood));
    }
    catch(std::out_of_range &e)
    {
        /* The flow reaches this point if mood is greater than skeleton.
        */
        cocos2d::log("Leafy::inform_fires_and_set_mood(): %s", e.what());
    }
}
예제 #5
0
void *LibMgr::OpenLibHandle(Library lib)
{
	void *ptr = GetPtr(lib);
	
	MEMORY_BASIC_INFORMATION mem;
	if (VirtualQuery(ptr, &mem, sizeof(mem)) == 0) {
		char err[4096];
		libsys->GetPlatformError(err, sizeof(err));
		
		DevMsg("LibMgr::OpenLibHandle: can't find library \"%s\" in memory\n"
			"VirtualQuery error:\n%s\n", libnames.at(lib), err);
		return nullptr;
	}
	
	return mem.AllocationBase;
}
T SceneDescription::getReferenceAttribute(
	const tinyxml2::XMLElement* node,
	const char* attributeName,
	const std::map<std::string, T>& map)
{
	std::string attr = getAttribute(node, attributeName);
	if (map.find(attr) == map.end())
	{
		throw SceneDescriptionException(
			"This '" + std::string(node->Name()) + "' node's '" + std::string(attributeName) +
			"' attribute has a value of '" + attr +
			"', but no appropriate element could be found for '" + attr + "'.");
	}

	return map.at(attr);
}
예제 #7
0
bool GetAccumulatorValueFromChecksum(uint32_t nChecksum, bool fMemoryOnly, CBigNum& bnAccValue)
{
    if (mapAccumulatorValues.count(nChecksum)) {
        bnAccValue = mapAccumulatorValues.at(nChecksum);
        return true;
    }

    if (fMemoryOnly)
        return false;

    if (!zerocoinDB->ReadAccumulatorValue(nChecksum, bnAccValue)) {
        bnAccValue = 0;
    }

    return true;
}
예제 #8
0
SISCAT::RETURN::Return_t Ruler::getData(
		const std::map<std::string, std::string>& param, std::string& result)
{
	if(m_MidLevel == 0)
	{
		ReadMidLevel();
	}
	if (param.find("RULER_PIN_NUMBERS") == param.end())
	{
		return SISCAT::RETURN::PARAMETRO_INVALIDO;
	}
	std::string numMaxPin;
	numMaxPin = param.at("RULER_PIN_NUMBERS");

	return getDataRoutine(atoi(numMaxPin.c_str()), result);;
}
예제 #9
0
ResidualGraph::ResidualGraph(
		const Graph& original, 
		const OriginalNode& origSource, 
		const std::map<OriginalNode, size_t>& nodeTimestepMap, 
		bool useBackArcs,
		bool useOrderedNodeListInBF
):
	originalGraph_(original),
	useBackArcs_(useBackArcs),
	useOrderedNodeListInBF_(useOrderedNodeListInBF),
	residualDistMap_(*this),
	nodeUpdateOrderMap_(*this),
	bfDistMap_(*this),
	bfPredMap_(*this),
	bf(*this, residualDistMap_, bfProcess_, bfNextProcess_),
	firstPath_(true)
{
	reserveNode(lemon::countNodes(original));
	reserveArc(2 * lemon::countArcs(original));

	for(Graph::NodeIt origNode(original); origNode != lemon::INVALID; ++origNode)
	{
		Node n = addNode();
		originMap_[n] = origNode;
		residualNodeMap_[origNode] = n;
		nodeUpdateOrderMap_.set(n, nodeTimestepMap.at(origNode));
	}

	for(Graph::ArcIt origArc(original); origArc != lemon::INVALID; ++origArc)
	{
		residualArcProvidesTokens_[arcToPair(origArc)] = {};
		residualArcProvidesTokens_[arcToInversePair(origArc)] = {};
		residualArcForbidsTokens_[arcToPair(origArc)] = {};
		residualArcForbidsTokens_[arcToInversePair(origArc)] = {};
		residualArcMap_[arcToPair(origArc)] = ResidualArcProperties();
		residualArcMap_[arcToInversePair(origArc)] = ResidualArcProperties();
	}

	bfProcess_.reserve(lemon::countNodes(*this));
	bfNextProcess_.reserve(lemon::countNodes(*this));
	dirtyNodes_.reserve(lemon::countNodes(*this));

    bf.distMap(bfDistMap_);
    bf.predMap(bfPredMap_);
    source_ = residualNodeMap_.at(origSource);
}
예제 #10
0
const std::vector<std::string>&
getVehicleClassNamesList(SVCPermissions permissions) {
    // first check if it's cached
    if (vehicleClassNamesListCached.count(permissions) == 0) {
        const std::vector<std::string> classNames = SumoVehicleClassStrings.getStrings();
        std::vector<std::string> result;
        for (std::vector<std::string>::const_iterator it = classNames.begin(); it != classNames.end(); it++) {
            const int svc = (int)SumoVehicleClassStrings.get(*it);
            if ((svc & permissions) == svc && svc != SVC_IGNORING) {
                result.push_back(*it);
            }
        }
        // add it into vehicleClassNamesListCached
        vehicleClassNamesListCached[permissions] = result;
    }
    return vehicleClassNamesListCached.at(permissions);
}
예제 #11
0
파일: lib.cpp 프로젝트: biotty/rmg
bu_ptr
parse_note(PyObject * seq, double duration)
{
    if ( ! PyTuple_Check(seq)) throw std::runtime_error("note isn't Tuple");
    const int n = PyTuple_Size(seq);
    int i = 0;
    if (n == 0) throw std::runtime_error("note Tuple empty");
    PyObject * head = PyTuple_GetItem(seq, 0);
    if (PyNumber_Check(head)) {
        if (duration != 0) throw std::runtime_error("duration over-ridden");
        duration = tempo * parse_float(head);
        ++i;
    }
    if (i + 2 != n) throw std::runtime_error("note Tuple size invalid");
    std::string label = parse_string(PyTuple_GetItem(seq, i++));
    return (*orchestra.at(label))(duration, PyTuple_GetItem(seq, i++));
}
예제 #12
0
void addToMap( Vector4D key, 
                Vector3D value , 
                std::map<Vector4D, std::vector<Vector3D>*, vec4Compare> &vertexNormals)
{
    std::vector<Vector3D>* valueArray;
	try
	{
		valueArray = vertexNormals.at( key );
		valueArray->push_back( value );
	}
	catch(const std::out_of_range& e) 
	{
		valueArray = new std::vector<Vector3D>();
		valueArray->push_back( value );
		vertexNormals.insert( std::pair<Vector4D, std::vector<Vector3D>*>(key, valueArray) );
	}
}
/**
 * \ingroup group_gl_flexible_type
 * Given the printable name of a flexible_type type, returns its corresponding
 * \ref flex_type_enum enumeration value.
 * Reverse of \ref flex_type_enum_to_name.
 */
inline flex_type_enum flex_type_enum_from_name(const std::string& name) {
  static std::map<std::string, flex_type_enum> type_map{
    {"integer", flex_type_enum::INTEGER},
    {"datetime", flex_type_enum::DATETIME},
    {"float", flex_type_enum::FLOAT},
    {"string", flex_type_enum::STRING},
    {"array", flex_type_enum::VECTOR},
    {"recursive", flex_type_enum::LIST},
    {"dictionary", flex_type_enum::DICT},
    {"image", flex_type_enum::IMAGE},
    {"undefined", flex_type_enum::UNDEFINED}
  };
  if (type_map.count(name) == 0) {
    log_and_throw(std::string("Invalid flexible type name " + name));
  }
  return type_map.at(name);
}
예제 #14
0
std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParams& params)
{
	const std::string& name = Settings::getInstance()->getString("Scraper");
	std::unique_ptr<ScraperSearchHandle> handle(new ScraperSearchHandle());

	// Check if the Scraper in the settings still exists as a registered scraping source.
	if (scraper_request_funcs.find(name) == scraper_request_funcs.end())
	{
		LOG(LogWarning) << "Configured scraper (" << name << ") unavailable, scraping aborted.";
	}
	else
	{
		scraper_request_funcs.at(name)(params, handle->mRequestQueue, handle->mResults);
	}

	return handle;
}
static void parseUserOptions(int argc, char *argv[],
                             struct user_req &req,
                             po::variables_map &vm)
{
    parseCommandOptions(argc, argv, getUserOptions(), vm);
    try {
        if (vm.count("uid"))
            req.uid = vm["uid"].as<uid_t>();
        if (vm.count("usertype")){
            req.utype = user_type_map.at(vm["usertype"].as<std::string>());
        } else
            req.utype = SM_USER_TYPE_NORMAL;
    } catch (const std::out_of_range &e) {
        po::error er("Invalid user type found.");
        throw er;
    }
}
static void parseAppOptions(int argc, char *argv[],
                                struct app_inst_req &req,
                                po::variables_map &vm)
{

    parseCommandOptions(argc, argv, getAppOptions(), vm);

    if (vm.count("app"))
        req.appName = vm["app"].as<std::string>();
    if (vm.count("pkg"))
        req.pkgName = vm["pkg"].as<std::string>();
    if (vm.count("path")) {
        const std::vector<std::string> paths =
            vm["path"].as<std::vector<std::string> >();
        if (!loadPaths(paths, req)) {
            po::error e("Error in parsing path arguments.");
            throw e;
        }
    }
    if (vm.count("privilege")) {
        auto privVector = vm["privilege"].as<std::vector<std::string > >();
        for (auto &e : privVector)
            req.privileges.push_back(std::make_pair(e, std::string()));

        if (req.privileges.empty()) {
            po::error e("Error in parsing privilege arguments.");
            throw e;
        }
#ifdef BUILD_TYPE_DEBUG
        LogDebug("Passed privileges:");
        for (const auto &p : req.privileges) {
            LogDebug("    " << p.first);
        }
#endif
    }
    if (vm.count("uid"))
        req.uid = vm["uid"].as<uid_t>();
    if (vm.count("tizen"))
        req.tizenVersion = vm["tizen"].as<std::string>();
    if (vm.count("author-id"))
        req.authorName = vm["author-id"].as<std::string>();
    if (vm.count("install-type"))
        req.installationType = install_type_map.at(vm["install-type"].as<std::string>());

}
예제 #17
0
static void report_supporting_reads(std::vector<simple_read>& reads, std::map<int, std::string>& seq_name_dict,
                                    std::ostream& out) {
    out << "# All supporting sequences for this insertion (i.e. sequences that map inside the inserted element):" << 
            std::endl;
    sort(reads.begin(), reads.end(), comp_simple_read_pos);
    std::vector<simple_read>::iterator support_iter;
    for (support_iter = reads.begin(); support_iter != reads.end(); ++support_iter) {
        // Only write the part of the read that falls inside the inserted element.
        if ((*support_iter).is_split) {
            out << "?\t?\t?\t" << (*support_iter).name << "\t" << (*support_iter).sample_name << "\t" <<
                   (*support_iter).evidence_strand << "\t" << (*support_iter).unmapped_sequence << std::endl;
        } else {
            out << seq_name_dict.at((*support_iter).tid) << "\t" << (*support_iter).pos << "\t" << 
                   (*support_iter).strand << "\t" << (*support_iter).name << "\t" << (*support_iter).sample_name << 
                   "\t" << (*support_iter).evidence_strand << "\t" << (*support_iter).sequence << std::endl;
        }
    }
}
  bool withinGoalConstraints(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg,
                             const std::map<std::string, double>& constraints,
                             const trajectory_msgs::JointTrajectory& traj) {
    ROS_DEBUG("Checking goal constraints");
    int last = traj.points.size() - 1;
    for (size_t i = 0; i < msg->joint_names.size(); ++i)
    {
      double abs_error = fabs(msg->actual.positions[i]-traj.points[last].positions[i]);
      double goal_constraint = constraints.at(msg->joint_names[i]);
      if (goal_constraint >= 0 && abs_error > goal_constraint)
      {
	ROS_DEBUG("Bad constraint: %f, abs_errs: %f", goal_constraint, abs_error);
        return false;
      }
      ROS_DEBUG("Checking constraint: %f, abs_errs: %f", goal_constraint, abs_error);
    }
    return true;
  }
예제 #19
0
std::string Property::generateMetaDataDescription() const {
    static const std::map<Visibility, std::string> VisibilityConverter = {
        { Visibility::All, "All" },
        { Visibility::Developer, "Developer" },
        { Visibility::User, "User" },
        { Visibility::None, "None" }
    };
    Visibility visibility = _metaData.value<Visibility>(MetaDataKeyVisibility);
    bool isReadOnly = _metaData.value<bool>(MetaDataKeyReadOnly);

    std::string vis = VisibilityConverter.at(visibility);

    return
        MetaDataKey + " = {" +
        MetaDataKeyGroup +   " = '" + groupIdentifier() + "'," +
        MetaDataKeyVisibility + " = " + vis + "," +
        MetaDataKeyReadOnly +" = " + (isReadOnly ? "true" : "false") + "}";
}
예제 #20
0
파일: Polynomial.cpp 프로젝트: fnaser/drake
Polynomial<CoefficientType> Polynomial<CoefficientType>::evaluatePartial(
    const std::map<VarType, CoefficientType>& var_values) const {
  std::vector<Monomial> new_monomials;
  for (const Monomial& monomial : monomials) {
    CoefficientType new_coefficient = monomial.coefficient;
    std::vector<Term> new_terms;
    for (const Term& term : monomial.terms) {
      if (var_values.count(term.var)) {
        new_coefficient *= std::pow(var_values.at(term.var), term.power);
      } else {
        new_terms.push_back(term);
      }
    }
    Monomial new_monomial = {new_coefficient, new_terms};
    new_monomials.push_back(new_monomial);
  }
  return Polynomial(new_monomials.begin(), new_monomials.end());
}
예제 #21
0
    Checkpoint GetClosestCheckpoint(const int& nHeight, int& nHeightCheckpoint)
    {
        nHeightCheckpoint = -1;
        for (auto it : mapCheckpoints) {
            //only checkpoints that are less than the height requested (unless height is less than the first checkpoint)
            if (it.first < nHeight) {
                if (nHeightCheckpoint == -1)
                    nHeightCheckpoint = it.first;
                if (nHeight - it.first < nHeightCheckpoint)
                    nHeightCheckpoint = it.first;
            }
        }

        if (nHeightCheckpoint != -1)
            return mapCheckpoints.at(nHeightCheckpoint);

        return Checkpoint();
    }
예제 #22
0
void PredefinedChoiseAndReturnMenu(std::ostream &ost, std::istream &ist, std::string const &menuName,
	std::map<std::string, std::function<void()>> const &menuFunctions)
{
	for (;;)
	{
		PrintMenuMessage(ost, menuName, PrintNullMessageFunction());
		std::string command = ReadUserCommand(ist);

		if (menuFunctions.find(command) != menuFunctions.end())
		{
			menuFunctions.at(command)();
		}
		else if (command == "r")
		{
			return;
		}
	}
}
예제 #23
0
PLOTLIB_INLINE PMat::PMat( const std::vector< std::vector< int64_t > > &data,
                           const std::map< int64_t, std::string > &map )
{
    mStrData.resize( data.size() );
    size_t i = 0;

    for ( auto &vec : data )
    {
        for ( auto &val : vec )
        {
            mStrData[i].push_back( map.at( val ) );
        }

        ++i;
    }

    mDimension = CheckDimensions( mStrData );
}
예제 #24
0
void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float xs[], float ys[])
{
    for (int i = 0; i < num; ++i)
    {
        int id = ids[i];
        float x = xs[i];
        float y = ys[i];

        CC_CONTINUE_IF(s_TouchesIntergerDict.find(id) == s_TouchesIntergerDict.end());
        int index = s_TouchesIntergerDict.at(id);

        /* Add to the set to send to the director */
        CATouch* pTouch = s_pTouches[index];
        if (pTouch)
        {
            CCLOGINFO("Ending touches with id: %d, x=%f, y=%f", id, x, y);
            pTouch->setTouchInfo(index,
                                 (x - m_obViewPortRect.origin.x) / m_fScaleX,
                                 (y - m_obViewPortRect.origin.y) / m_fScaleY);

            set.addObject(pTouch);

            // release the object
            pTouch->release();
            s_pTouches[index] = NULL;
            removeUsedIndexBit(index);

            s_TouchesIntergerDict.erase(id);

        }
        else
        {
            CCLOG("Ending touches with id: %d error", id);
            return;
        }

    }

    if (set.count() == 0)
    {
        CCLOG("touchesEnded or touchesCancel: count = 0");
        return;
    }
}
GraphicsItemList GraphicsView::selectHitsGrahicsItems(GLuint hits, GLuint* buf, const std::map<int, GraphicsItemPtr>& indexToGraphicsItemMap)
{
	GraphicsItemList pickedGraphicsItems;
	std::map<GLuint, GraphicsItemPtr> depthGraphicsItemMap;

	// selectHitsGrahicsItem
	GLuint depth_1 = 1;
	GLuint depth_2 = 1;
	GLuint depth_name;
	GLuint* ptr;

	ptr = buf;

	for (unsigned int i = 0; i < hits; ++i) {
		depth_name = *ptr;				// 階層の深さ
		++ptr;
		depth_1 = *ptr;					// depth_min
		++ptr;
		depth_2 = *ptr;					// depth_max
		++ptr;

		std::vector<GLuint> index;
		for (unsigned int j = 0; j < depth_name; ++j) {
			index.push_back(*ptr);
			++ptr;
		}

		GraphicsItemPtr item = indexToGraphicsItemMap.at(index[0]);

		depthGraphicsItemMap[depth_1] = item;
	}

	// depth_min 順にソート
	for (auto itr = depthGraphicsItemMap.begin(); itr != depthGraphicsItemMap.end(); ++itr) {
		GraphicsItemPtr item = itr->second;
		if (pickedGraphicsItems.end() == std::find(pickedGraphicsItems.begin(), pickedGraphicsItems.end(), item)) {
			if (item) {
				pickedGraphicsItems.push_back(item);
			}
		}
	}

	return pickedGraphicsItems;
}
예제 #26
0
void genSMBIOSTables(const uint8_t* tables, size_t length, QueryData& results) {
  // Keep a pointer to the end of the SMBIOS data for comparison.
  auto tables_end = tables + length;
  auto table = tables;

  // Iterate through table structures within SMBIOS data range.
  size_t index = 0;
  while (table + sizeof(SMBStructHeader) <= tables_end) {
    auto header = (const SMBStructHeader*)table;
    if (table + header->length > tables_end) {
      // Invalid header, length must be within SMBIOS data range.
      break;
    }

    Row r;
    // The index is a supliment that keeps track of table order.
    r["number"] = INTEGER(index++);
    r["type"] = INTEGER((unsigned short)header->type);
    if (kSMBIOSTypeDescriptions.count(header->type) > 0) {
      r["description"] = kSMBIOSTypeDescriptions.at(header->type);
    }

    r["handle"] = BIGINT((unsigned long long)header->handle);
    r["header_size"] = INTEGER((unsigned short)header->length);

    // The SMBIOS structure may have unformatted, double-NULL delimited trailing
    // data, which are usually strings.
    auto next_table = table + header->length;
    for (; next_table + sizeof(SMBStructHeader) <= tables_end; next_table++) {
      if (next_table[0] == 0 && next_table[1] == 0) {
        next_table += 2;
        break;
      }
    }

    auto table_length = next_table - table;
    r["size"] = INTEGER(table_length);
    r["md5"] = hashFromBuffer(HASH_TYPE_MD5, table, table_length);

    table = next_table;
    results.push_back(r);
  }
}
예제 #27
0
	void free(void * ptr)
	{
		char * charPtr = static_cast<char *>(ptr);
		Block & prev = prevBlock(charPtr);
		Block & next = nextBlock(charPtr);
		Block & block = blocks.at(charPtr);

		assert(block.free == false);
		assert(prev.ptr == NULL || prev.ptr + prev.size == block.ptr);
		assert(next.ptr == NULL || block.ptr + block.size == next.ptr);

		/* prev is busy and next is busy */
		/* just mark current block as free */
		if(!prev.free && !next.free)
		{	
			markBlockFree(block);
		}
		/* prev is free and next is busy */
		/* concat prev and curr block into one free block */
		else if(prev.free && !next.free)
		{
			resizeBlock(prev, prev.size + block.size);
			removeBlock(block);
		}
		/* prev is busy and next is free */
		/* concat curr and next block into one free block */
		else if(!prev.free && next.free)
		{
			resizeBlock(block, block.size + next.size);
			removeBlock(next);
			markBlockFree(block);
		}
		/* concat all three blocks into one block*/
		else if(prev.free && next.free)
		{
			resizeBlock(prev, prev.size + block.size + next.size);
			removeBlock(block);
			removeBlock(next);
		}
		#ifdef SELFTEST
		selfTest();
		#endif
	}
예제 #28
0
void GeneralPane::CreateAdvanced()
{
  auto* advanced_group = new QGroupBox(tr("Advanced Settings"));
  auto* advanced_group_layout = new QVBoxLayout;
  advanced_group->setLayout(advanced_group_layout);
  m_main_layout->addWidget(advanced_group);

  // Speed Limit
  auto* engine_group = new QGroupBox(tr("CPU Emulation Engine"));
  auto* engine_group_layout = new QVBoxLayout;
  engine_group->setLayout(engine_group_layout);
  advanced_group_layout->addWidget(engine_group);

  for (PowerPC::CPUCore cpu_core : PowerPC::AvailableCPUCores())
  {
    m_cpu_cores.emplace_back(new QRadioButton(tr(CPU_CORE_NAMES.at(cpu_core))));
    engine_group_layout->addWidget(m_cpu_cores.back());
  }
}
예제 #29
0
   /*!
    * Set the buffer size for each connection. Warning: This function is collective.
    *
    * \param [in] mapSize maps the rank of the connected servers to the size of the correspoinding buffer
    * \param [in] maxEventSize maps the rank of the connected servers to the size of the biggest event
   */
   void CContextClient::setBufferSize(const std::map<int,StdSize>& mapSize, const std::map<int,StdSize>& maxEventSize)
   {
     mapBufferSize_ = mapSize;
     maxEventSizes = maxEventSize;

     // Compute the maximum number of events that can be safely buffered.
     double minBufferSizeEventSizeRatio = std::numeric_limits<double>::max();
     for (std::map<int,StdSize>::const_iterator it = mapSize.begin(), ite = mapSize.end(); it != ite; ++it)
     {
       double ratio = double(it->second) / maxEventSize.at(it->first);
       if (ratio < minBufferSizeEventSizeRatio) minBufferSizeEventSizeRatio = ratio;
     }
     MPI_Allreduce(MPI_IN_PLACE, &minBufferSizeEventSizeRatio, 1, MPI_DOUBLE, MPI_MIN, intraComm);

     if (minBufferSizeEventSizeRatio < 1.0)
     {
       ERROR("void CContextClient::setBufferSize(const std::map<int,StdSize>& mapSize, const std::map<int,StdSize>& maxEventSize)",
             << "The buffer sizes and the maximum events sizes are incoherent.");
     }
예제 #30
0
    void decodeStore() // 62
    {
        uint32_t pointer = decodeId();
        uint32_t object = decodeId();

        std::cout << ident() << "Store ";
        if(names.find(pointer) != names.end())
            std::cout << names.at(pointer);
        else
            std::cout << pointer;
         std::cout << " " << object;

        if(offset + 1 < length)
        {
            uint32_t memoryAccess = decodeId();
            std::cout << " " << memoryAccess;
        }

        std::cout << std::endl;
    }