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


C++ map::end方法代码示例

本文整理汇总了C++中std::map::end方法的典型用法代码示例。如果您正苦于以下问题:C++ map::end方法的具体用法?C++ map::end怎么用?C++ map::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::map的用法示例。


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

示例1: antennaTable

AveragingMSRowProvider::AveragingMSRowProvider(double nWavelengthsAveraging, const string& msPath, const MSSelection& selection, const std::map<size_t, size_t>& selectedDataDescIds, const string& dataColumnName, bool requireModel) :
	MSRowProvider(msPath, selection, selectedDataDescIds, dataColumnName, requireModel)
{
	casacore::MSAntenna antennaTable(_ms.antenna());
	_nAntennae = antennaTable.nrow();
	
	casacore::ROArrayColumn<double> positionColumn(antennaTable, casacore::MSAntenna::columnName(casacore::MSAntennaEnums::POSITION));
	std::vector<Pos> positions(_nAntennae);

	casacore::Array<double> posArr(casacore::IPosition(1, 3));
	for(size_t i=0; i!=_nAntennae; ++i)
	{
		positionColumn.get(i, posArr);
		positions[i] = Pos(posArr.data()[0], posArr.data()[1], posArr.data()[2]);
	}
	
	// dataDescId x ant x ant
	_nElements = selectedDataDescIds.size() * _nAntennae * _nAntennae;
	_averagingFactors.assign(_nElements, 0.0);
	_buffers.resize(_nElements);
	MultiBandData bands(_ms.spectralWindow(), _ms.dataDescription());
	
	double dt = (EndTime() - StartTime()) / (EndTimestep() - StartTimestep());
	Logger::Debug << "Assuming integration time of " << dt * (24.0*60.0*60.0) << " seconds.\n";
	
	size_t element = 0;
	size_t averagingSum = 0, minAvgFactor = std::numeric_limits<size_t>::max(), maxAvgFactor = 0;
	for(size_t a1=0; a1!=_nAntennae; ++a1)
	{
		Pos pos1 = positions[a1];
		for(size_t a2=0; a2!=_nAntennae; ++a2)
		{
			Pos pos2 = positions[a2];
			double dx = std::get<0>(pos1) - std::get<0>(pos2);
			double dy = std::get<1>(pos1) - std::get<1>(pos2);
			double dz = std::get<2>(pos1) - std::get<2>(pos2);
			double dist = sqrt(dx*dx + dy*dy + dz*dz);
			for(std::map<size_t, size_t>::const_iterator spwIter=selectedDataDescIds.begin();
					spwIter!=selectedDataDescIds.end(); ++spwIter)
			{
				BandData band = bands[spwIter->first];
				double lambda = band.SmallestWavelength();
				double nWavelengthsPerIntegration = 2.0 * M_PI * dist / lambda * dt;
				_averagingFactors[element] = std::max<size_t>(size_t(floor(nWavelengthsAveraging / nWavelengthsPerIntegration)), 1);
				averagingSum += _averagingFactors[element];
				if(a1 != a2)
				{
					minAvgFactor = std::min<size_t>(minAvgFactor, _averagingFactors[element]);
					maxAvgFactor = std::max<size_t>(maxAvgFactor, _averagingFactors[element]);
				}
				//Logger::Debug << a1 << '\t' << a2 << '\t' << _averagingFactors[element] << '\n';
				++element;
			}
		}
	}
	Logger::Info << "Averaging factor for longest baseline: " << minAvgFactor << " x . For the shortest: " << maxAvgFactor << " x \n";
	
	_spwIndexToDataDescId.resize(selectedDataDescIds.size());
	for(std::map<size_t, size_t>::const_iterator spwIter=selectedDataDescIds.begin();
		spwIter!=selectedDataDescIds.end(); ++spwIter)
	{
		_spwIndexToDataDescId[spwIter->second] = spwIter->first;
	}
	
	_averageFactorSum = 0.0;
	_rowCount = 0;
	_averagedRowCount = 0;

	_currentData = DataArray(DataShape());
	_currentModel = DataArray(DataShape());
	_currentFlags = FlagArray(DataShape());
	_currentWeights = WeightArray(DataShape());
	_averagedDataDescId = _currentDataDescId;
	_flushPosition = 0;
	
	if(!MSRowProvider::AtEnd())
	{
		bool timestepAvailable = processCurrentTimestep();
		if(!timestepAvailable)
			NextRow();
	}
}
开发者ID:kernsuite-debian,项目名称:wsclean,代码行数:82,代码来源:averagingmsrowprovider.cpp

示例2: Search

	int Search(const char* k)
	{
		std::map<std::string, int>::iterator i = tree.find(std::string(k));
		return i != tree.end() ? i->second:0;
	}
开发者ID:gejza,项目名称:xcdev,代码行数:5,代码来源:tree.cpp

示例3: value

fostlib::headers_base::content::content(
    const string &val, const std::map< string, string > &args)
: m_subvalues( args.begin(), args.end() ), value( val ) {
}
开发者ID:,项目名称:,代码行数:4,代码来源:

示例4: GetAssocModel

QString QAutoGenDialog::GetAssocModel(const QString & strParam, const QString & strType, std::map<QString, QString> & mapAssocModels, const std::map<QString, QString> & mapAssocModelTypes, std::map<QString, std::map<QString, AutoGenParameter> > & mapAssocParams, unsigned int iVehicle)
{
	// first, check list of models to see if one of the right type exists
	std::map<QString, QString>::iterator iterModel = mapAssocModels.find(strParam);

	if (iterModel == mapAssocModels.end())
	{
		if (strType.compare(NULLMODEL_NAME) == 0)
			iterModel = mapAssocModels.insert(std::pair<QString, QString>(strParam, "NULL")).first;
		else
		{
			// no such luck, let's make a new model
			std::map<QString, std::map<QString, ModelParameter> >::iterator iterModelParams = m_pMapParams->find(strType);
			std::map<QString, ModelParameter>::iterator iterParam;
			std::map<QString, unsigned int>::iterator iterModelIndex = m_mapModelIndexes.find(strType);
			std::map<QString, QString>::const_iterator iterModelType;
			std::map<QString, QString> mapParams;
			std::map<QString, std::map<QString, AutoGenParameter> >::iterator iterAutoParams = mapAssocParams.find(strParam);
			std::map<QString, AutoGenParameter>::iterator iterAutoParam;
			QStringList listDepends;
			QStringList::iterator iterDepend;
			std::set<QString> setDepends;
			std::set<QString>::iterator iterSetDepend;
			QString strName;
			unsigned iModel = iterModelIndex == m_mapModelIndexes.end() ? 0 : iterModelIndex->second;
			while (m_pModelNames->find(strName = QString("%1%2").arg(strType).arg(iModel)) != m_pModelNames->end())
				iModel++;
			if (iterModelParams != m_pMapParams->end() && iterAutoParams != mapAssocParams.end())
			{
				for (iterAutoParam = iterAutoParams->second.begin(); iterAutoParam != iterAutoParams->second.end(); ++iterAutoParam)
				{
					iterParam = iterModelParams->second.find(iterAutoParam->first);
					switch (iterAutoParam->second.eType)
					{
					case AutoGenParamTypeDepends:
						listDepends = QStringList::split(';', iterAutoParam->second.strValue);
						for (iterDepend = listDepends.begin(); iterDepend != listDepends.end(); ++iterDepend)
							setDepends.insert(*iterDepend);
						break;
					case AutoGenParamTypeNewModel:
						iterModelType = mapAssocModelTypes.find(iterAutoParam->first);
						if (iterModelType == mapAssocModelTypes.end())
							mapParams[iterAutoParam->first] = GetAssocModel(iterAutoParam->first, iterAutoParam->second.strValue, mapAssocModels, mapAssocModelTypes, mapAssocParams, iVehicle);
						else
							mapParams[iterAutoParam->first] = GetAssocModel(iterAutoParam->first, iterModelType->second, mapAssocModels, mapAssocModelTypes, mapAssocParams, iVehicle);
						setDepends.insert(mapParams[iterAutoParam->first]);
						break;
					case AutoGenParamTypeRandom: // randomize
						mapParams[iterAutoParam->first] = GetRandomParameter(iterAutoParam->first, iterAutoParam->second.strValue, iterParam->second);
						break;
					case AutoGenParamTypeFile: // choose file
						mapParams[iterAutoParam->first] = GetFileParameter(iterAutoParam->first, iterAutoParam->second.strValue, iVehicle);
						break;
					default:
						mapParams[iterAutoParam->first] = iterAutoParam->second.strValue;
						break;
					}
				}
			}
			setDepends.erase("NULL");
			mapParams[PARAM_DEPENDS] = QString::null;
			for (iterSetDepend = setDepends.begin(); iterSetDepend != setDepends.end(); ++iterSetDepend)
			{
				if (mapParams[PARAM_DEPENDS].isEmpty())
					mapParams[PARAM_DEPENDS] = *iterSetDepend;
				else
					mapParams[PARAM_DEPENDS] += (';' + *iterSetDepend);
			}
			iterModel = mapAssocModels.insert(std::pair<QString, QString>(strParam, strName)).first;
			m_pModels->insert(std::pair<QString, std::map<QString, QString> >(strName, mapParams));
			m_pModelList->push_back(std::pair<QString, QString>(strName, strType));
			m_pModelNames->insert(strName);
			listDepends.clear();
			if (iterModelIndex != m_mapModelIndexes.end())
				iterModelIndex->second = iModel + 1;
			else
				m_mapModelIndexes[strType] = iModel + 1;
		}
	}
	return iterModel->second;
}
开发者ID:vigneshananth,项目名称:Groovenet-Qt4,代码行数:81,代码来源:QAutoGenDialog.cpp

示例5: ParsePattern

bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM,
                           unsigned LineNumber) {
  this->LineNumber = LineNumber;
  PatternLoc = SMLoc::getFromPointer(PatternStr.data());

  // Ignore trailing whitespace.
  while (!PatternStr.empty() &&
         (PatternStr.back() == ' ' || PatternStr.back() == '\t'))
    PatternStr = PatternStr.substr(0, PatternStr.size()-1);

  // Check that there is something on the line.
  if (PatternStr.empty()) {
    SM.PrintMessage(PatternLoc, SourceMgr::DK_Error,
                    "found empty check string with prefix '" +
                    CheckPrefix+":'");
    return true;
  }

  // Check to see if this is a fixed string, or if it has regex pieces.
  if (PatternStr.size() < 2 ||
      (PatternStr.find("{{") == StringRef::npos &&
       PatternStr.find("[[") == StringRef::npos)) {
    FixedStr = PatternStr;
    return false;
  }

  // Paren value #0 is for the fully matched string.  Any new parenthesized
  // values add from there.
  unsigned CurParen = 1;

  // Otherwise, there is at least one regex piece.  Build up the regex pattern
  // by escaping scary characters in fixed strings, building up one big regex.
  while (!PatternStr.empty()) {
    // RegEx matches.
    if (PatternStr.startswith("{{")) {
      // This is the start of a regex match.  Scan for the }}.
      size_t End = PatternStr.find("}}");
      if (End == StringRef::npos) {
        SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()),
                        SourceMgr::DK_Error,
                        "found start of regex string with no end '}}'");
        return true;
      }

      // Enclose {{}} patterns in parens just like [[]] even though we're not
      // capturing the result for any purpose.  This is required in case the
      // expression contains an alternation like: CHECK:  abc{{x|z}}def.  We
      // want this to turn into: "abc(x|z)def" not "abcx|zdef".
      RegExStr += '(';
      ++CurParen;

      if (AddRegExToRegEx(PatternStr.substr(2, End-2), CurParen, SM))
        return true;
      RegExStr += ')';

      PatternStr = PatternStr.substr(End+2);
      continue;
    }

    // Named RegEx matches.  These are of two forms: [[foo:.*]] which matches .*
    // (or some other regex) and assigns it to the FileCheck variable 'foo'. The
    // second form is [[foo]] which is a reference to foo.  The variable name
    // itself must be of the form "[a-zA-Z_][0-9a-zA-Z_]*", otherwise we reject
    // it.  This is to catch some common errors.
    if (PatternStr.startswith("[[")) {
      // Find the closing bracket pair ending the match.  End is going to be an
      // offset relative to the beginning of the match string.
      size_t End = FindRegexVarEnd(PatternStr.substr(2));

      if (End == StringRef::npos) {
        SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()),
                        SourceMgr::DK_Error,
                        "invalid named regex reference, no ]] found");
        return true;
      }

      StringRef MatchStr = PatternStr.substr(2, End);
      PatternStr = PatternStr.substr(End+4);

      // Get the regex name (e.g. "foo").
      size_t NameEnd = MatchStr.find(':');
      StringRef Name = MatchStr.substr(0, NameEnd);

      if (Name.empty()) {
        SM.PrintMessage(SMLoc::getFromPointer(Name.data()), SourceMgr::DK_Error,
                        "invalid name in named regex: empty name");
        return true;
      }

      // Verify that the name/expression is well formed. FileCheck currently
      // supports @LINE, @LINE+number, @LINE-number expressions. The check here
      // is relaxed, more strict check is performed in \c EvaluateExpression.
      bool IsExpression = false;
      for (unsigned i = 0, e = Name.size(); i != e; ++i) {
        if (i == 0 && Name[i] == '@') {
          if (NameEnd != StringRef::npos) {
            SM.PrintMessage(SMLoc::getFromPointer(Name.data()),
                            SourceMgr::DK_Error,
                            "invalid name in named regex definition");
            return true;
//.........这里部分代码省略.........
开发者ID:32bitmicro,项目名称:llvm,代码行数:101,代码来源:FileCheck.cpp

示例6: IsUserKnown

 gcc_pure
 bool IsUserKnown(uint32_t id) const {
   return user_names.find(id) != user_names.end();
 }
开发者ID:ahsparrow,项目名称:xcsoar,代码行数:4,代码来源:Data.hpp

示例7: readEventData

/**
 * Return the confidence with with this algorithm can load the file
 * @param eventEntries map of the file entries that have events
 * @param outputGroup pointer to the workspace group
 * @param nxFile Reads data from inside first first top entry
 */
void LoadMcStas::readEventData(
    const std::map<std::string, std::string> &eventEntries,
    WorkspaceGroup_sptr &outputGroup, ::NeXus::File &nxFile) {
  std::string filename = getPropertyValue("Filename");
  auto entries = nxFile.getEntries();
  bool errorBarsSetTo1 = getProperty("ErrorBarsSetTo1");
  // will assume that each top level entry contain one mcstas
  // generated IDF and any event data entries within this top level
  // entry are data collected for that instrument
  // This code for loading the instrument is for now adjusted code from
  // ExperimentalInfo.

  // Close data folder and go back to top level. Then read and close the
  // Instrument folder.
  nxFile.closeGroup();

  Geometry::Instrument_sptr instrument;

  // Initialize progress reporting
  int reports = 2;
  const double progressFractionInitial = 0.1;
  Progress progInitial(this, 0.0, progressFractionInitial, reports);

  try {
    nxFile.openGroup("instrument", "NXinstrument");
    std::string instrumentXML;
    nxFile.openGroup("instrument_xml", "NXnote");
    nxFile.readData("data", instrumentXML);
    nxFile.closeGroup();
    nxFile.closeGroup();

    progInitial.report("Loading instrument");

    std::string instrumentName = "McStas";
    Geometry::InstrumentDefinitionParser parser(filename, instrumentName, instrumentXML);
    std::string instrumentNameMangled = parser.getMangledName();

    // Check whether the instrument is already in the InstrumentDataService
    if (InstrumentDataService::Instance().doesExist(instrumentNameMangled)) {
      // If it does, just use the one from the one stored there
      instrument =
          InstrumentDataService::Instance().retrieve(instrumentNameMangled);
    } else {
      // Really create the instrument
      instrument = parser.parseXML(NULL);
      // Add to data service for later retrieval
      InstrumentDataService::Instance().add(instrumentNameMangled, instrument);
    }
  } catch (...) {
    // Loader should not stop if there is no IDF.xml
    g_log.warning()
        << "\nCould not find the instrument description in the Nexus file:"
        << filename << " Ignore evntdata from data file" << std::endl;
    return;
  }
  // Finished reading Instrument. Then open new data folder again
  nxFile.openGroup("data", "NXdetector");

  // create and prepare an event workspace ready to receive the mcstas events
  progInitial.report("Set up EventWorkspace");
  EventWorkspace_sptr eventWS(new EventWorkspace());
  // initialize, where create up front number of eventlists = number of
  // detectors
  eventWS->initialize(instrument->getNumberDetectors(), 1, 1);
  // Set the units
  eventWS->getAxis(0)->unit() = UnitFactory::Instance().create("TOF");
  eventWS->setYUnit("Counts");
  // set the instrument
  eventWS->setInstrument(instrument);
  // assign detector ID to eventlists

  std::vector<detid_t> detIDs = instrument->getDetectorIDs();

  for (size_t i = 0; i < instrument->getNumberDetectors(); i++) {
    eventWS->getEventList(i).addDetectorID(detIDs[i]);
    // spectrum number are treated as equal to detector IDs for McStas data
    eventWS->getEventList(i).setSpectrumNo(detIDs[i]);
  }
  // the one is here for the moment for backward compatibility
  eventWS->rebuildSpectraMapping(true);

  bool isAnyNeutrons = false;
  // to store shortest and longest recorded TOF
  double shortestTOF(0.0);
  double longestTOF(0.0);

  const size_t numEventEntries = eventEntries.size();
  Progress progEntries(this, progressFractionInitial, 1.0, numEventEntries * 2);
  for (auto eit = eventEntries.begin(); eit != eventEntries.end(); ++eit) {
    std::string dataName = eit->first;
    std::string dataType = eit->second;

    // open second level entry
    nxFile.openGroup(dataName, dataType);
//.........这里部分代码省略.........
开发者ID:stothe2,项目名称:mantid,代码行数:101,代码来源:LoadMcStas.cpp

示例8: ProcessRequest

void CAirPlayServer::CTCPClient::PushBuffer(CAirPlayServer *host, const char *buffer,
                                            int length, CStdString &sessionId, std::map<CStdString,
                                            int> &reverseSockets)
{
  HttpParser::status_t status = m_httpParser->addBytes(buffer, length);

  if (status == HttpParser::Done)
  {
    // Parse the request
    CStdString responseHeader;
    CStdString responseBody;
    CStdString reverseHeader;
    CStdString reverseBody;
    int status = ProcessRequest(responseHeader, responseBody, reverseHeader, reverseBody, sessionId);
    CStdString statusMsg = "OK";
    int reverseSocket = INVALID_SOCKET;

    switch(status)
    {
      case AIRPLAY_STATUS_NOT_IMPLEMENTED:
        statusMsg = "Not Implemented";
        break;
      case AIRPLAY_STATUS_SWITCHING_PROTOCOLS:
        statusMsg = "Switching Protocols";
        reverseSockets[sessionId] = m_socket;//save this socket as reverse http socket for this sessionid
        break;
      case AIRPLAY_STATUS_NEED_AUTH:
        statusMsg = "Unauthorized";
        break;
    }

    // Prepare the response
    CStdString response;
    const time_t ltime = time(NULL);
    char *date = asctime(gmtime(&ltime)); //Fri, 17 Dec 2010 11:18:01 GMT;
    date[strlen(date) - 1] = '\0'; // remove \n
    response.Format("HTTP/1.1 %d %s\nDate: %s\r\n", status, statusMsg.c_str(), date);
    if (responseHeader.size() > 0)
    {
      response += responseHeader;
    }

    if (responseBody.size() > 0)
    {
      response.Format("%sContent-Length: %d\r\n", response.c_str(), responseBody.size());
    }
    response += "\r\n";

    if (responseBody.size() > 0)
    {
      response += responseBody;
    }

    // Send the response
    //don't send response on AIRPLAY_STATUS_NO_RESPONSE_NEEDED
    if (status != AIRPLAY_STATUS_NO_RESPONSE_NEEDED)
    {
      send(m_socket, response.c_str(), response.size(), 0);
    }

    // Send event status per reverse http socket (play, loading, paused)
    // if we have a reverse header and a reverse socket
    if (reverseHeader.size() > 0 && reverseSockets.find(sessionId) != reverseSockets.end())
    {
      //search the reverse socket to this sessionid
      response.Format("POST /event HTTP/1.1\r\n");
      reverseSocket = reverseSockets[sessionId]; //that is our reverse socket
      response += reverseHeader;
    }
    response += "\r\n";

    if (reverseBody.size() > 0)
    {
      response += reverseBody;
    }

    if (reverseSocket != INVALID_SOCKET)
    {
      send(reverseSocket, response.c_str(), response.size(), 0);//send the event status on the eventSocket
    }

    // We need a new parser...
    delete m_httpParser;
    m_httpParser = new HttpParser;
  }
}
开发者ID:,项目名称:,代码行数:86,代码来源:

示例9: parseMeshInfo

static void parseMeshInfo(MeshModel* root, float curr_time)
{
	_log("OBJECT_NODE_TAG");
	enterChunk();
	std::string    name, inst;
	Vector         pivot;
	Animation      anim;
	unsigned short id = 65535, parent = 65535, flags1, flags2;
	Box            box = Box(Vector(), Vector());
	Vector         box_centre;
	while (int chunk_id = nextChunk()) {
		switch (chunk_id) {
		case 0xb030: //NODE_ID
			in.sgetn((char*)&id, 2);
			_log("NODE_ID: " + itoa(id));
			break;
		case 0xb010: //NODE_HDR
			name = parseString();
			in.sgetn((char*)&flags1, 2);
			in.sgetn((char*)&flags2, 2);
			in.sgetn((char*)&parent, 2);
			_log("NODE_HDR: name=" + name + " parent=" + itoa(parent));
			break;
		case 0xb011: //INSTANCE NAME
			inst = parseString();
			_log("INSTANCE_NAME: " + inst);
			break;
		case 0xb013: //PIVOT
			in.sgetn((char*)&pivot, 12);
			if (conv)
				pivot = conv_tform * pivot;
			_log("PIVOT: " + ftoa(pivot.x) + "," + ftoa(pivot.y) + "," + ftoa(pivot.z));
			break;
		case 0xb014: //BOUNDBOX
			in.sgetn((char*)&(box.a), 12);
			in.sgetn((char*)&(box.b), 12);
			box_centre = box.centre();
			if (conv)
				box_centre = conv_tform * box_centre;
			_log("BOUNDBOX: min=" + ftoa(box.a.x) + "," + ftoa(box.a.y) + "," + ftoa(box.a.z) + " max=" + ftoa(box.b.x)
				 + "," + ftoa(box.b.y) + "," + ftoa(box.b.z));
			break;
		case 0xb020: //POS_TRACK_TAG
		case 0xb021: //ROT_TRACK_TAG
		case 0xb022: //SCALE_TRACK_TAG
			if (!collapse)
				parseAnimKeys(&anim, chunk_id);
			break;
		}
	}
	leaveChunk();

	MeshModel* p = root;
	if (parent != 65535) {
		std::map<int, MeshModel*>::const_iterator it = id_map.find(parent);
		if (it == id_map.end())
			return;
		p = it->second;
	}
	MeshModel* mesh = 0;
	if (name == "$$$DUMMY") {
		mesh = new MeshModel();
		mesh->SetName(inst);
		mesh->SetParent(p);
	} else {
		std::map<std::string, MeshModel*>::const_iterator it = name_map.find(name);
		if (it == name_map.end())
			return;
		mesh = it->second;
		name_map.erase(name);
		if (pivot != Vector()) {
			mesh->transform(-pivot);
		}
		Transform t = mesh->GetWorldTransform();
		mesh->SetParent(p);
		mesh->SetWorldTransform(t);
	}

	mesh->setAnimation(anim);

	if (id != 65535)
		id_map[id] = mesh;
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:83,代码来源:loader_3ds.cpp

示例10:

static AuCtx *getAacCtx(u32 id) {
	if (aacMap.find(id) == aacMap.end())
		return NULL;
	return aacMap[id];
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:5,代码来源:sceMp4.cpp

示例11: __AACShutdown

void __AACShutdown() {
	for (auto it = aacMap.begin(), end = aacMap.end(); it != end; it++) {
		delete it->second;
	}
	aacMap.clear();
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:6,代码来源:sceMp4.cpp

示例12: configure

returnValue ExportCommonHeader::configure(	const std::string& _moduleName,
											bool _useSinglePrecision,
											bool _useComplexArithmetic,
											QPSolverName _qpSolver,
											const std::map<std::string, std::pair<std::string, std::string> >& _options,
											const std::string& _variables,
											const std::string& _workspace,
											const std::string& _functions
											)
{
	// Configure the template
	string foo = _moduleName;
	transform(foo.begin(), foo.end(), foo.begin(), ::toupper);
	dictionary[ "@[email protected]" ] = foo;

	stringstream ss;
	if( _useComplexArithmetic ) ss << "\n#include <complex.h>\n" << endl;

	ss 	<< "/** qpOASES QP solver indicator. */" << endl
		<< "#define ACADO_QPOASES  0" << endl
		<< "#define ACADO_QPOASES3 1" << endl
		<< "/** FORCES QP solver indicator.*/" << endl
		<< "#define ACADO_FORCES   2" << endl
		<< "/** qpDUNES QP solver indicator.*/" << endl
		<< "#define ACADO_QPDUNES  3" << endl
		<< "/** HPMPC QP solver indicator. */" << endl
		<< "#define ACADO_HPMPC    4" << endl
		<< "/** Indicator for determining the QP solver used by the ACADO solver code. */" << endl;

	switch ( _qpSolver )
	{
	case QP_QPOASES:
		ss << "#define ACADO_QP_SOLVER ACADO_QPOASES\n" << endl;
		ss << "#include \"" << _moduleName << "_qpoases_interface.hpp\"\n";

		break;

	case QP_QPOASES3:
		ss << "#define ACADO_QP_SOLVER ACADO_QPOASES3\n" << endl;
		ss << "#include \"" << _moduleName << "_qpoases3_interface.h\"\n";

		break;

	case QP_FORCES:
	case QP_HPMPC:
	case QP_QPDUNES:
		if (_qpSolver == QP_FORCES)
			ss << "#define ACADO_QP_SOLVER ACADO_FORCES\n" << endl;
		else if (_qpSolver == QP_HPMPC)
			ss << "#define ACADO_QP_SOLVER ACADO_HPMPC\n" << endl;
		else
			ss << "#define ACADO_QP_SOLVER ACADO_QPDUNES\n" << endl;

		ss << "\n#include <string.h>\n\n" << endl;

		ss << "/** Definition of the floating point data type. */\n";
		if (_useSinglePrecision == true)
			ss << "typedef float real_t;\n";
		else
			ss << "typedef double real_t;\n";

		break;
	
	case QP_NONE:
		ss << "/** Definition of the floating point data type. */\n";
		if (_useSinglePrecision == true)
			ss << "typedef float real_t;\n";
		else
			ss << "typedef double real_t;\n";

		break;

	default:
		return ACADOERROR( RET_INVALID_OPTION );

	}
	dictionary[ "@[email protected]" ] = ss.str();

	ss.str( string() );
	// Key: define name
	// Value.first: value
	// Value.second: comment
	std::map<std::string, std::pair<std::string, std::string> >::const_iterator it;
	for (it = _options.begin(); it != _options.end(); ++it)
	{
		ss << "/** " << it->second.second << " */" << endl;
		ss << "#define " << it->first << " " << it->second.first << endl;
	}

	dictionary[ "@[email protected]" ] = ss.str();

	dictionary[ "@[email protected]" ] = _variables;

	dictionary[ "@[email protected]" ] = _workspace;

	dictionary[ "@[email protected]" ] = _functions;

	// And then fill a template file
	fillTemplate();

//.........这里部分代码省略.........
开发者ID:ferreau,项目名称:acado,代码行数:101,代码来源:export_common_header.cpp

示例13: if

std::string convertDVBUTF8(const char *data, int len, int table, int tsidonid)
{
	int newtable = 0;
	bool twochar = false;
	if (!len)
		return "";

	int i=0, t=0;

	if ( tsidonid )
	{
		std::map<int, int>::iterator it =
			TransponderDefaultMapping.find(tsidonid);
		if ( it != TransponderDefaultMapping.end() )
			table = it->second;
		twochar = TransponderUseTwoCharMapping.find(tsidonid) != TransponderUseTwoCharMapping.end();
	}
//printf("table %d tsidonid %04x twochar %d : %20s\n", table, tsidonid, twochar, data);
	switch(data[0])
	{
		case 1 ... 12:
			newtable=data[i++]+4;
//			eDebug("(1..12)text encoded in ISO-8859-%d",table);
			break;
		case 0x10:
		{
//			eDebug("(0x10)text encoded in ISO-8859-%d",n);
			int n=(data[i+1]<<8)|(data[i+2]);
			i += 3;
			switch(n)
			{
				case 12: 
					{} //eDebug("unsup. ISO8859-12 enc.", n);
				default:
					newtable=n;
					break;
			}
			break;
		}
		case 0x11:
			{} //eDebug("unsup. Basic Multilingual Plane of ISO/IEC 10646-1 enc.");
			++i;
			break;
		case 0x12:
			++i;
			{} //eDebug("unsup. KSC 5601 enc.");
			break;
		case 0x13:
			++i;
			{} //eDebug("unsup. GB-2312-1980 enc.");
			break;
		case 0x14:
			++i;
			{} //eDebug("unsup. Big5 subset of ISO/IEC 10646-1 enc.");
			break;
		case 0x0:
		case 0xD ... 0xF:
		case 0x15 ... 0x1F:
			{} //eDebug("reserved %d", data[0]);
			++i;
			break;
	}
	if(!table)
		table = newtable;
//dprintf("recode:::: tsidonid %X table %d two-char %d len %d\n", tsidonid, table, twochar, len);
	unsigned char res[2048];
	while (i < len)
	{
		unsigned long code=0;

		if ( i+1 < len && twochar && (code=doVideoTexSuppl(data[i], data[i+1])) ) {
			i+=2;
//dprintf("recode:::: doVideoTexSuppl code %lX\n", code);
		}

		if (!code)
			code=recode(data[i++], table);
		if (!code)
			continue;
				// Unicode->UTF8 encoding
		if (code < 0x80) // identity ascii <-> utf8 mapping
			res[t++]=char(code);
		else if((table == 5) && (code == 0x8A))
			res[t++]= 0x20;
		else if (code < 0x800) // two byte mapping
		{
			res[t++]=(code>>6)|0xC0;
			res[t++]=(code&0x3F)|0x80;
		} else if (code < 0x10000) // three bytes mapping
开发者ID:Firmeware,项目名称:max-tdt,代码行数:89,代码来源:edvbstring.cpp

示例14: ExecFilter

void filter_dlg::ExecFilter() {
	std::unique_ptr<dbseltweetmsg> loadmsg;

	SetNoUpdateFlag_All();

	fdg->shared_state->apply_filter.EnableUndo();

	tweetidset dbset;

	for (auto id : fdg->selectedset) {
		optional_tweet_ptr tobj = ad.GetExistingTweetById(id);
		if (!tobj) {
			if (ad.unloaded_db_tweet_ids.find(id) != ad.unloaded_db_tweet_ids.end()) {
				// This is in DB
				dbset.insert(id);
				continue;
			}

			// fallback, shouldn't happen too often
			tobj = ad.GetTweetById(id);
		}

		if (CheckFetchPendingSingleTweet(tobj, std::shared_ptr<taccount>(), &loadmsg, PENDING_REQ::USEREXPIRE, PENDING_RESULT::CONTENT_READY)) {
			FilterOneTweet(fdg->shared_state->apply_filter, tobj);
		} else {
			tobj->AddNewPendingOp(std::unique_ptr<pending_op>(new applyfilter_pending_op(fdg->shared_state)));
		}
	}
	if (loadmsg) {
		loadmsg->flags |= DBSTMF::CLEARNOUPDF;
		DBC_PrepareStdTweetLoadMsg(*loadmsg);
		DBC_SendMessage(std::move(loadmsg));
	} else {
		CheckClearNoUpdateFlag_All();
	}

	if (!dbset.empty()) {
		filter_set fs;
		LoadFilter(fdg->shared_state->apply_filter.filter_text, fs);

		// Do not send shared_state to the completion callback/DB thread, as this would
		// cause major problems if for whatever reason a reply was not sent and the message and
		// thus callback was destructed in the DB thread, in the case where it held the last reference
		// to the shared_state. The shared_state destructor may not be run in the DB thread.

		static std::map<uint64_t, std::shared_ptr<filter_dlg_shared_state>> pending_db_filters;
		static uint64_t next_id;
		uint64_t this_id = next_id++;
		pending_db_filters[this_id] = fdg->shared_state;

		filter_set::DBFilterTweetIDs(std::move(fs), std::move(dbset), true, [this_id](std::unique_ptr<undo::action> undo) {
			auto it = pending_db_filters.find(this_id);
			if (it != pending_db_filters.end()) {
				it->second->db_undo_action = std::move(undo);
				pending_db_filters.erase(it);
				LogMsgFormat(LOGT::FILTERTRACE, "filter_dlg::ExecFilter: DB filter complete, %zu pending", pending_db_filters.size());
			} else {
				LogMsgFormat(LOGT::FILTERERR, "filter_dlg::ExecFilter: DB filter completion: item missing from pending_db_filters!");
			}
		});
	}
}
开发者ID:JGRennison,项目名称:retcon,代码行数:62,代码来源:filter-dlg.cpp

示例15:

//
// Creates an iterator over a collection of ties represented by the
// given map. The values of the pairs in the map represent the values
// of ties, and the keys represent the corresponding neighbors.
//
IncidentTieIterator::IncidentTieIterator(const std::map<int, int> & ties) :
		ITieIterator(), //
		lstart(ties.begin()), //
		lcurrent(lstart), //
		lend(ties.end()) {
}
开发者ID:rforge,项目名称:rsiena,代码行数:11,代码来源:IncidentTieIterator.cpp


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