• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ stringVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: replace

void
ProgrammableOpAttributes::AddFunction(const std::string& name, const stringVector& atts)
{
    JSONNode vars = JSONNode::JSONArray();
    for(int i = 0; i < atts.size(); ++i)
        vars.Append(atts[i]);

    JSONNode node;
    node["vars"] = vars;

    std::string argstring = "";
    for(size_t i = 0; i < atts.size(); ++i)
        argstring += atts[i] + (i == atts.size()-1 ? "" : ",");

   // char buf[1024];
   // sprintf(buf,"import visit_internal_funcs\nsetout(visit_internal_funcs.%s(%s))",name.c_str(),argstring.c_str());

    std::ostringstream ostr;

    ostr << "import visit_internal_funcs\n"
         << "setout(visit_internal_funcs." << name << "(" << argstring << "))" << std::endl;

    std::string escapedCode = ostr.str();
    //std::cout << escapedCode << std::endl;
    replace(escapedCode, "\n", "\\n");

    node["source"] = escapedCode;

    script["scripts"][name] = node;

    //update scriptmap
    scriptMap = script.ToString();
    Select(ID_scriptMap, (void *)&scriptMap);
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:34,代码来源:ProgrammableOpAttributes.C


示例2:

void 
XMLNode::GetAttributeNames(stringVector &result) const
{
    result.clear();
    map<string,string>::const_iterator itr;
    for(itr =attributes.begin(); itr != attributes.end();++itr)
        result.push_back(itr->first);
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:8,代码来源:XMLNode.C


示例3:

// ****************************************************************************
// Method: QvisScatterPlotWizardPage::GetSelectedVars()
//
// Purpose: Returns the names of the selected variables.
//
// Programmer: Cyrus Harrison
// Creation:  Wed Aug 18 15:26:15 PDT 2010
//
//
// Modifications:
//
// ****************************************************************************
void
QvisScatterPlotWizardPage::GetSelectedVars(stringVector &res) const
{
    res.clear();
    res.push_back(xVarName);
    res.push_back(yVarName);
    res.push_back(zVarName);
    res.push_back(colorVarName);
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:21,代码来源:QvisScatterPlotWizardPage.C


示例4:

void
ViewerDatabaseCorrelationMethods::DeclineCorrelationCreation(const stringVector &dbs)
{
    if(dbs.size() > 0)
    {
        for(size_t i = 0; i < dbs.size(); ++i)
            declinedFiles.push_back(dbs[i]);
        declinedFilesLength.push_back((int)dbs.size());
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:10,代码来源:ViewerDatabaseCorrelationMethods.C


示例5: GetStringVectorFromPyObject

bool
GetStringVectorFromPyObject(PyObject *obj, stringVector &vec)
{
    bool retval = true;

    if(obj == 0)
    {
        retval = false;
    }
    else if(PyTuple_Check(obj))
    {
        // Extract arguments from the tuple.
        for(int i = 0; i < PyTuple_Size(obj); ++i)
        {
            PyObject *item = PyTuple_GET_ITEM(obj, i);
            if(PyString_Check(item))
                vec.push_back(PyString_AS_STRING(item));
            else
            {
                VisItErrorFunc("The tuple must contain all strings.");
                retval = false;
                break;
            }
        }
    }
    else if(PyList_Check(obj))
    {
        // Extract arguments from the list.
        for(int i = 0; i < PyList_Size(obj); ++i)
        {
            PyObject *item = PyList_GET_ITEM(obj, i);
            if(PyString_Check(item))
                vec.push_back(PyString_AS_STRING(item));
            else
            {
                VisItErrorFunc("The list must contain all strings.");
                retval = false;
                break;
            }
        }
    }
    else if(PyString_Check(obj))
    {
        vec.push_back(PyString_AS_STRING(obj));
    }
    else
    {
        retval = false;
        VisItErrorFunc("The object could not be converted to a "
                       "vector of strings.");
    }

    return retval;
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:54,代码来源:PyProgrammableOpAttributes.C


示例6: SelectPreferredIDs

// ****************************************************************************
// Method:  FileOpenOptions::AddFallbackFormatsToPreferred
//
// Purpose:
//   Adds any given formats to the *end* of the preferred list, moving
//   their position to the back if they were already in the list.
//
// Arguments:
//   given    the list of formats labeled as "fallback"
//
// Programmer:  Jeremy Meredith
// Creation:    March 26, 2010
//
// ****************************************************************************
void
FileOpenOptions::AddFallbackFormatsToPreferred(const stringVector &given)
{
    // for each format, append it
    for (size_t i=0; i<given.size(); i++)
    {
        // get its actual ID
        std::string id = "";
        for (size_t j=0; j<typeIDs.size(); j++)
        {
            if (given[i] == typeIDs[j] ||
                given[i] == typeNames[j])
            {
                id = typeIDs[j];
                break;
            }
        }
        // if no id, we don't have that plugin, so skip this one
        if (id == "")
            continue;

        // make a new list with this given one at the back
        stringVector newPreferredIDs;
        for (size_t j=0; j<preferredIDs.size(); j++)
        {
            if (preferredIDs[j] != id)
                newPreferredIDs.push_back(preferredIDs[j]);
        }
        newPreferredIDs.push_back(id);
        preferredIDs = newPreferredIDs;
    }
    SelectPreferredIDs();
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:47,代码来源:FileOpenOptions.C


示例7:

ProgrammableOperation::ResponseType
avtProgrammableOperation::avtVisItForEachLocation::getSignature(std::string& name,
                          stringVector& argnames,
                          std::vector<ScriptType>& argtypes)
{
    name = "visit_foreach_location";
    argnames.push_back("window");
    argtypes.push_back(ProgrammableOperation::INT_VECTOR_TYPE);

    argnames.push_back("variableName");
    argtypes.push_back(ProgrammableOperation::VTK_DATA_ARRAY_TYPE);

    argnames.push_back("kernelLanguage");
    argtypes.push_back(ProgrammableOperation::STRING_TYPE);

    argnames.push_back("kernel");
    argtypes.push_back(ProgrammableOperation::STRING_TYPE);

    argnames.push_back("kernelName");
    argtypes.push_back(ProgrammableOperation::STRING_TYPE);

    argnames.push_back("primaryVariable");
    argtypes.push_back(ProgrammableOperation::STRING_TYPE);

    argnames.push_back("kernelArgs");
    argtypes.push_back(ProgrammableOperation::VARIANT_VECTOR_TYPE);
    return ProgrammableOperation::VTK_MULTI_DIMENSIONAL_DATA_ARRAY;
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:28,代码来源:avtProgrammableOperation.C


示例8:

void
Dyna3DFile::GetMaterials(intVector &matnos, stringVector &matnames, doubleVector &matdens)
{
    for(int i = 0; i < materialCards.size(); ++i)
    {
        matnos.push_back(materialCards[i].materialNumber);
        matnames.push_back(materialCards[i].materialName);
        matdens.push_back(materialCards[i].density);
    }
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:10,代码来源:Dyna3DFile.cpp


示例9: loadDirRange

void loadDirRange(std::string &dir, std::string &firstDir, std::string &lastDir, stringVector &tables)
	throw (std::invalid_argument)
{
	/* remove slash, if any */
	if (firstDir[firstDir.length()-1] == '/') {
		firstDir.resize(firstDir.length()-1);
	}
	if (lastDir[lastDir.length()-1] == '/') {
		lastDir.resize(lastDir.length()-1);
	}

	/* check that first dir comes before last dir */
	if (strverscmp(firstDir.c_str(), lastDir.c_str()) > 0) {
		throw std::invalid_argument(lastDir + " comes before " + firstDir);
	}

	struct dirent **namelist;
	int dirs_counter;

	/* scan for subdirectories */
	dirs_counter = scandir(dir.c_str(), &namelist, NULL, versionsort);
	if (dirs_counter < 0) {
#ifdef DEBUG
		std::cerr << "Cannot scan directory " << dir << ": " << strerror(errno) << std::endl;
#endif
		return;
	}
	/*
	 * namelist now contains dirent structure for every entry in directory.
	 * the structures are sorted according to versionsort, which is ok for most cases
	 */

	int counter = 0;
	struct dirent *dent;

	while(dirs_counter--) {
		dent = namelist[counter++];

		/* Check that the directory is in range and not '.' or '..' */
		if (dent->d_type == DT_DIR && strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") &&
			strverscmp(dent->d_name, firstDir.c_str()) >= 0 && strverscmp(dent->d_name, lastDir.c_str()) <= 0) {

			std::string tableDir = dir + dent->d_name;
			Utils::sanitizePath(tableDir);
			tables.push_back(std::string(tableDir));
		}

		free(namelist[counter-1]);
	}
	free(namelist);
}
开发者ID:VisBlank,项目名称:ipfixcol,代码行数:51,代码来源:Utils.cpp


示例10:

void
ConfigManager::RemoveLeadAndTailQuotes(stringVector &sv)
{
    for(size_t i = 0; i < sv.size(); ++i)
    {
        std::string &s = sv[i];
        if(s.size() > 0)
        {
            int head = (s[0] == '"') ? 1 : 0;
            int tail = (s[s.size()-1] == '"') ? 1 : 0;
            sv[i] = s.substr(head, s.size() - head - tail);
        }
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:14,代码来源:ConfigManager.C


示例11:

void
PluginManagerAttributes::UniqueCategories(const std::string &t, stringVector &c) const
{
    c.clear();
    for(size_t i = 0; i < type.size(); ++i)
    {
        if(type[i] == t)
        {
            if(i < category.size() &&
                    category[i] != "?" &&
                    std::find(c.begin(), c.end(), category[i]) == c.end())
                c.push_back(category[i]);
        }
    }
    std::sort(c.begin(), c.end());
}
开发者ID:ahota,项目名称:visit_intel,代码行数:16,代码来源:PluginManagerAttributes.C


示例12:

bool
QvisPlotListBox::NeedsToBeRegenerated(const PlotList *pl,
    const stringVector &prefixes, const stringVector &createdSelections) const
{
    bool retval = true;

    if(pl->GetNumPlots() == count() && prefixes.size() == (size_t)count())
    {
        for(int i = 0; i < pl->GetNumPlots(); ++i)
        {
            QvisPlotListBoxItem *lbi = (QvisPlotListBoxItem *)item(i);
            const Plot &newPlot = pl->operator[](i);
            const Plot &currentPlot = lbi->GetPlot();

            // See if the prefixes are different.
            if(prefixes[i] != std::string(lbi->GetPrefix().toStdString()))
                 return true;

            // See if the createdSelections are different.
            if(createdSelections[i] != std::string(lbi->GetSelectionName().toStdString()))
                 return true;

            // See if the plots are different
            bool nu = newPlot.GetStateType() != currentPlot.GetStateType() ||
                   newPlot.GetPlotType() != currentPlot.GetPlotType() ||
                   newPlot.GetHiddenFlag() != currentPlot.GetHiddenFlag() ||
                   newPlot.GetExpandedFlag() != currentPlot.GetExpandedFlag() ||
                   newPlot.GetActiveOperator() != currentPlot.GetActiveOperator() ||
                   newPlot.GetPlotVar() != currentPlot.GetPlotVar() ||
                   newPlot.GetDatabaseName() != currentPlot.GetDatabaseName() ||
                   newPlot.GetOperators() != currentPlot.GetOperators() ||
                   newPlot.GetDescription() != currentPlot.GetDescription() ||
                   newPlot.GetSelection() != currentPlot.GetSelection() ||
                   newPlot.GetFollowsTime() != currentPlot.GetFollowsTime();

            if(nu) return true;
        }
        return false;
    }

    return retval;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:42,代码来源:QvisPlotListBox.C


示例13:

avtCentering
avtMissingDataFilter::MissingDataCentering(const stringVector &vars) const
{
    bool mixed = false;
    avtCentering c0 = AVT_ZONECENT;
    for(size_t i = 0; i < vars.size(); ++i)
    {
        const avtScalarMetaData *scalar = metadata.GetScalar(vars[i]);
        if(scalar != NULL)
        {
            avtCentering thisC = scalar->centering;
            if(i == 0)
                c0 = thisC;
            if(thisC != c0)
            {
                mixed = true;
                break;
            }
        }
    }

    return mixed ? AVT_ZONECENT : c0;
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:23,代码来源:avtMissingDataFilter.C


示例14: loadDirsTree

void loadDirsTree(std::string basedir, std::string first, std::string last, stringVector &tables)
{
	struct dirent **namelist;
	int dirs_counter;

	sanitizePath(basedir);
	
	/* Find root directories */
	std::string root_first = rootDir(first);
	std::string root_last = rootDir(last);

	/* scan for subdirs */
	dirs_counter = scandir(basedir.c_str(), &namelist, NULL, versionsort);
	if (dirs_counter < 0) {
#ifdef DEBUG
		std::cerr << "Cannot stat directory " << basedir << ": " << strerror(errno) << std::endl;
#endif
		return;
	}

	/* Add all directories into vector */
	for (int i = 0; i < dirs_counter; ++i) {
		std::string entry_name = namelist[i]->d_name;

		/* Ignore . and .. */
		if (entry_name == "." || entry_name == "..") {
			continue;
		}

		/* If first dir was given, ignore entries before it */
		if (!root_first.empty() && strverscmp(entry_name.c_str(), root_first.c_str()) < 0) {
			continue;
		} else if (strverscmp(entry_name.c_str(), root_first.c_str()) == 0) {
			if (root_first == first.substr(0, first.length() - 1)) {
				/* Found first folder */
				std::string tableDir = basedir + entry_name;
				sanitizePath(tableDir);
				tables.push_back(tableDir);
			} else {
				/* Go deeper and find first folder */
				std::string new_basedir = basedir + entry_name;
				std::string new_first = first.substr(root_first.length() + 1);
				loadDirsTree(new_basedir, new_first, "", tables);
			}
		} else if (root_last.empty() || strverscmp(entry_name.c_str(), root_last.c_str()) < 0) {
			/* Entry is between first and last */
			std::string tableDir = basedir + entry_name;
			sanitizePath(tableDir);
			tables.push_back(tableDir);
		} else if (strverscmp(entry_name.c_str(), root_last.c_str()) == 0){
			/* Entry == root_last */
			if (root_last == last.substr(0, last.length() - 1)) {
				/* We're on last level, add last directory to vector */
				std::string tableDir = basedir + entry_name;
				sanitizePath(tableDir);
				tables.push_back(tableDir);
			} else {
				/* Goo deeper */
				std::string new_basedir = basedir + entry_name;
				std::string new_last = last.substr(root_last.length() + 1);
				loadDirsTree(new_basedir, "", new_last, tables);
			}
		}
	}

}
开发者ID:VisBlank,项目名称:ipfixcol,代码行数:66,代码来源:Utils.cpp


示例15: if

bool
ProgrammableOpAttributes::SetupPipeline(const JSONNode& atts, stringVector& args, const std::string& parent)
{
    if(atts.GetType() != JSONNode::JSONARRAY)
        return false;

    const JSONNode::JSONArray& array = atts.GetArray();

    for(int i = 0; i < array.size(); ++i)
    {
        /// need key, value pair
        /// this can be in the form of a dictionary, "a = b", pair tuple (a,b), or a pair array [a,b]
        JSONNode node = array[i];
        JSONNode key,value;
        if(node.GetType() == JSONNode::JSONARRAY)
        {
            if(node.GetArray().size() != 2) continue;

            key = node.GetArray()[0];
            value = node.GetArray()[1];
        }
        else if(node.GetType() == JSONNode::JSONOBJECT)
        {
            /// parse through dictionary and compute arguments from names..
            const JSONNode::JSONObject& obj = node.GetJsonObject();
            if(obj.size() != 1) continue;

            const JSONNode::JSONObject::const_iterator itr = obj.begin();
            key = itr->first;
            value = itr->second;
        }
        else if(node.GetType() == JSONNode::JSONSTRING)
        {
            std::string pair = node.GetString();
            int index = pair.find("=");
            if(index == std::string::npos) continue;
            key = pair.substr(0,index);

            value = trim(pair.substr(index+1));
         }

        if(key.GetType() != JSONNode::JSONSTRING) continue;

        std::string keystr = trim(key.GetString());

        std::ostringstream str;
        str << "import json\n";
        if(value.GetType() == JSONNode::JSONSTRING)
        {
            std::string v = trim(value.GetString());

            ///character at 0 and has :
            if(v.find(":") != std::string::npos && v.find(":") == 0)
            {
                /// optionally handle whether it can be as_vtkarray, as_ndarray, or as_rarray

                size_t index = v.find(":as_ndarray");

                if(index == std::string::npos)
                    index = v.find(":as_rarray");

                if(index != std::string::npos)
                {
                    std::string newName = getNextName();
                    v = v.substr(0,index);
                    AddNode(newName, "as_ndarray");
                    AddConnection(v, newName, "in");
                    AddConnection(newName,parent,keystr);
                }
                else
                {
                    index = v.find(":as_vtkarray");
                    if(index != std::string::npos)
                        v = v.substr(0,index);
                    AddConnection(v,parent,keystr);
                }
            }
            else
            {
                std::string escapedCode = trim(value.GetString());
                replace(escapedCode,"\n","\\\n");
                replace(escapedCode,"'","\"");
                escapedCode = "'" + escapedCode + "'";

                str << "try:\n"
                    << " a = json.loads(" << escapedCode << ")\n"
                    << "except:\n"
                    << " a = " << escapedCode << "\n"
                    << "setout(a)\n";

                AddPythonScript(keystr,stringVector(),str.str());
                AddNode(keystr,keystr);
                AddConnection(keystr,parent,keystr);
            }
        }
        else
        {
            str << "setout(json.loads('" << trim(value.ToString()) << "'))\n";

            AddPythonScript(keystr,stringVector(),str.str());
//.........这里部分代码省略.........
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:101,代码来源:ProgrammableOpAttributes.C


示例16: switch

bool
avtMissingDataFilter::TagMissingData(vtkDataSet *in_ds, vtkDataArray *missingData, 
    const stringVector &varsMissingData, avtCentering centering) const
{
    bool missing = false;
    unsigned char *mdptr = (unsigned char *)missingData->GetVoidPointer(0);

    // Go through each variable and populate the avtMissingData array.
    for(size_t i = 0; i < varsMissingData.size(); ++i)
    {
        const avtScalarMetaData *scalar = metadata.GetScalar(varsMissingData[i]);
        if(scalar != NULL)
        {
            // Try checking the current variable against the cell data.
            vtkDataArray *arr = in_ds->GetCellData()->GetArray(varsMissingData[i].c_str());
            if(arr != 0)
            {
                debug5 << "\tApplying rule for cell data \"" << varsMissingData[i]
                       << "\" to avtMissingData" << endl;
                vtkIdType nCells = in_ds->GetNumberOfCells();

                switch(scalar->GetMissingDataType())
                {
                case avtScalarMetaData::MissingData_Value:
                    { // new scope
                    double missingValue = scalar->GetMissingData()[0];
                    for(vtkIdType cellid = 0; cellid < nCells; ++cellid)
                    {
                        if(arr->GetTuple1(cellid) == missingValue)
                        {
                            mdptr[cellid] = 1;
                            missing = true;
                        }
                    }
                    }
                    break;
                case avtScalarMetaData::MissingData_Valid_Min:
                    { // new scope
                    double minValue = scalar->GetMissingData()[0];
                    for(vtkIdType cellid = 0; cellid < nCells; ++cellid)
                    {
                        if(arr->GetTuple1(cellid) < minValue)
                        {
                            mdptr[cellid] = 1;
                            missing = true;
                        }
                    }
                    }
                    break;
                case avtScalarMetaData::MissingData_Valid_Max:
                    { // new scope
                    double maxValue = scalar->GetMissingData()[0];
                    for(vtkIdType cellid = 0; cellid < nCells; ++cellid)
                    {
                        if(arr->GetTuple1(cellid) > maxValue)
                        {
                            mdptr[cellid] = 1;
                            missing = true;
                        }
                    }
                    }
                    break;
                case avtScalarMetaData::MissingData_Valid_Range:
                    { // new scope
                    double minValue = scalar->GetMissingData()[0];
                    double maxValue = scalar->GetMissingData()[1];
                    for(vtkIdType cellid = 0; cellid < nCells; ++cellid)
                    {
                        double val = arr->GetTuple1(cellid);
                        if(val < minValue || val > maxValue)
                        {
                            mdptr[cellid] = 1;
                            missing = true;
                        }
                    }
                    }
                    break;
                default:
                    break;
                }
            }

            // Try checking the current variable against the point data.
            arr = in_ds->GetPointData()->GetArray(varsMissingData[i].c_str());
            if(arr != 0)
            {
                debug5 << "\tApplying rule for point data \"" << varsMissingData[i]
                       << "\" to avtMissingData. Storing values as "
                       << (centering==AVT_ZONECENT?"cells":"points") << endl;

                vtkIdType nPoints = in_ds->GetNumberOfPoints();
                vtkIdList *idList = vtkIdList::New();
                switch(scalar->GetMissingDataType())
                {
                case avtScalarMetaData::MissingData_Value:
                    { // new scope
                    double missingValue = scalar->GetMissingData()[0];
                    if(centering == AVT_NODECENT)
                    {
                        for(vtkIdType ptid = 0; ptid < nPoints; ++ptid)
//.........这里部分代码省略.........
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:101,代码来源:avtMissingDataFilter.C


示例17: GetInput

avtContract_p
avtModelFitFilter::ModifyContract(avtContract_p in_spec){
    std::string db = GetInput()->GetInfo().GetAttributes().GetFullDBName();
    ref_ptr<avtDatabase> dbp = avtCallback::GetDatabase(db, 0, NULL);
    avtDatabaseMetaData *md = dbp->GetMetaData(0);

    numTimesteps = (int)md->GetTimes().size();
    activeTs = in_spec->GetDataRequest()->GetTimestep();

    std::string meshName = GetInput()->GetInfo().GetAttributes().GetMeshname();

    pipelineVar = in_spec->GetDataRequest()->GetVariable();
    new_pipelineVar = strdup(pipelineVar);

    const stringVector curListedVars = atts.GetVars();

    if(!curListedVars.size())
    return in_spec;
  
    if((!strcmp(pipelineVar, "operators/ModelFit/model")) || 
       (!strcmp(pipelineVar, "operators/ModelFit/distance")))
        for(int i = 0; ; i++)
          if((strcmp(curListedVars[i].c_str(), "operators/ModelFit/model")) && 
             (strcmp(curListedVars[i].c_str(), "operators/ModelFit/distance")))
            {
                strcpy(new_pipelineVar, curListedVars[i].c_str());
                break;
            }

    avtDataRequest_p aDR  = new avtDataRequest(in_spec->GetDataRequest(), new_pipelineVar);
    aDR->SetOriginalVariable(pipelineVar);
    avtContract_p outSpec = new avtContract(in_spec, aDR);

    const char *curListedVar;
    std::vector<CharStrRef> curSecondaryVars = outSpec->GetDataRequest()->GetSecondaryVariables();
    size_t listedVarNum, secVarNum;
    char secVarName[1024];

    for(listedVarNum = 0; listedVarNum < curListedVars.size(); listedVarNum++){
        curListedVar = curListedVars[listedVarNum].c_str();
    
        if(strcmp(curListedVar, pipelineVar)){
            for(secVarNum = 0; secVarNum < curSecondaryVars.size(); secVarNum++)
                if(!strcmp(*curSecondaryVars[secVarNum], curListedVar))
                    break;
            if(secVarNum >= curSecondaryVars.size())
                outSpec->GetDataRequest()->AddSecondaryVariable(curListedVar);
            sprintf(secVarName, "%s", curListedVar);
        }
        curSecondaryVars = outSpec->GetDataRequest()->GetSecondaryVariables();
    }
    
    curSecondaryVars = outSpec->GetDataRequest()->GetSecondaryVariables();
    for(secVarNum = 0; secVarNum < curSecondaryVars.size(); secVarNum++){
        if(!strcmp(*curSecondaryVars[secVarNum], "operators/ModelFit/distance"))
            outSpec->GetDataRequest()->RemoveSecondaryVariable("operators/ModelFit/distance");

        if(!strcmp(*curSecondaryVars[secVarNum], "operators/ModelFit/model"))
            outSpec->GetDataRequest()->RemoveSecondaryVariable("operators/ModelFit/model");
    }
    return outSpec;
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:62,代码来源:avtModelFitFilter.C


示例18: GetVisItEnvironment

std::string 
GetVisItEnvironment(stringVector &env, bool useShortFileName, bool addPluginVars, bool &usingdev)
{
    char *tmp, *visitpath = NULL;
    char *visitdevdir = NULL;
    char tmpdir[512];
    bool haveVISITHOME = false;
    usingdev = false;
    bool freeVisItPath = true;
    string config;

    tmp = (char *)malloc(10000);

    /*
     * Determine visit path
     */
    haveVISITHOME = ReadKey("VISITHOME", &visitpath);

    if (!haveVISITHOME)
    {
        free(visitpath);
        visitpath = NULL;
        if ((visitpath = getenv("VISITHOME")) != NULL)
        {
            haveVISITHOME = true;
            freeVisItPath = false;
        }
    }

    /*
     * We could not get the value associated with the key. It may mean
     * that VisIt was not installed properly. Use a default value.
     */
    if(!haveVISITHOME)
    {
        char tmpdir[MAX_PATH];
        if (GetModuleFileName(NULL, tmpdir, MAX_PATH) != 0)
        {
            size_t pos = 0;
            size_t len = strlen(tmpdir);
            for (pos = len; tmpdir[pos] != '\\' && pos >=0; pos--)
            {
                continue;
            }
            if (pos <= 0)
                pos = len;

            visitpath = (char*)malloc(pos +1);
            strncpy(visitpath, tmpdir, pos);
            visitpath[pos] = '\0';
         }
    }
    /*
     * Determine if this is dev version
     */
    {
        string vp(visitpath);
        string tp = vp + "\\..\\" + "ThirdParty";
        struct _stat fs;
        if (_stat(tp.c_str(), &fs) == 0)
        {
            usingdev = 1;
            size_t pos;
            size_t len = strlen(visitpath);
            for (pos = len; visitpath[pos] != '\\' && pos >=0; pos--)
            {
                continue;
            }
            if (pos <= 0)
                pos = len;

            visitdevdir = (char*)malloc(pos + 14);
            strncpy(visitdevdir, visitpath, pos);
            visitdevdir[pos] = '\0';
            strncat(visitdevdir, "\\ThirdParty", 14);
            if (len != pos)
                config = vp.substr(pos+1);
        }
    }
 
    /*
     * Determine visit user path (Path to My Documents).
     */
    {
        char visituserpath[MAX_PATH], expvisituserpath[MAX_PATH];
        bool haveVISITUSERHOME=0;
        TCHAR szPath[MAX_PATH];
        struct _stat fs;
        if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 
                                 SHGFP_TYPE_CURRENT, szPath))) 
        {
            SNPRINTF(visituserpath, 512, "%s\\VisIt", szPath);
            haveVISITUSERHOME = true;
        }

        if (haveVISITUSERHOME)
        {
            ExpandEnvironmentStrings(visituserpath,expvisituserpath,512);
            if (_stat(expvisituserpath, &fs) == -1)
            {
//.........这里部分代码省略.........
开发者ID:cchriste,项目名称:visit,代码行数:101,代码来源:visit.c


示例19: if

bool
LaunchService::SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs)
{
    const char *mName="LaunchService::SetupGatewaySocketBridgeIfNeeded: ";

    // Get the port and host.
    int  oldlocalport       = -1;
    int  portargument       = -1;
    int  hostargument       = -1;
    for (size_t i=0; i<launchArgs.size(); i++)
    {
        if (i<launchArgs.size()-1 && launchArgs[i] == "-port")
        {
            oldlocalport = atoi(launchArgs[i+1].c_str());
            portargument = i+1;
        }
        else if (i<launchArgs.size()-1 && launchArgs[i] == "-host")
        {
            hostargument = i+1;
        }
    }

    bool setupBridge = (portargument != -1 && hostargument != -1);
    if(setupBridge)
    {
        debug5 << mName << "Setting up gateway port bridge.\n";
        // find a new local port
        int lowerRemotePort = 10000;
        int upperRemotePort = 40000;
        int remotePortRange = 1+upperRemotePort-lowerRemotePort;

#if defined(_WIN32)
        srand((unsigned)time(0));
        int newlocalport = lowerRemotePort+(rand()%remotePortRange);
#else
        srand48(long(time(0)));
        int newlocalport = lowerRemotePort+(lrand48()%remotePortRange);
#endif
        debug5 << mName << "Bridging new port INADDR_ANY/" << newlocalport
               << " to tunneled port localhost/" << oldlocalport << endl;

        // replace the host with my host name
        char hostname[1024];
        gethostname(hostname,1024);
        launchArgs[hostargument] = hostname;

        // replace the launch argument port number
        char newportstr[10];
        sprintf(newportstr,"%d",newlocalport);
        launchArgs[portargument] = newportstr;

        // fork and start the socket bridge
        int *ports = new int[2];
        ports[0] = newlocalport;
        ports[1] = oldlocalport;
#ifdef _WIN32
        _beginthread(CreateSocketBridge, 0, (void*)ports);
#else
        switch (fork())
        {
          case -1:
            // Could not fork.
            exit(-1); // HOOKS_IGNORE
            break;
          case 0:
              {
                  // The child process will start the bridge
                  // Close stdin and any other file descriptors.
                  fclose(stdin);
                  for (int k = 3 ; k < 32 ; ++k)
                  {
                      close(k);
                  }
                  CreateSocketBridge((void*)ports);
                  exit(0); // HOOKS_IGNORE
                  break;
              }
          default:
            // Parent process continues on as normal
            // Caution: there is a slight race condition here, though
            // it would require the engine to launch and try to connect
            // back before the child process got the bridge set up.
            // The odds of this happening are low, but it should be fixed.
            break;
        }
#endif
    }
    else
    {
        debug5 << mName << "Required -host or -port argument not found" << endl;
    }

    return setupBridge;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:94,代码来源:LaunchService.C


示例20: SetVisItEnvironment

void
SetVisItEnvironment(const stringVector &env)
{
    for(size_t i = 0; i < env.size(); ++i)
        _putenv(env[i].c_str());
}
开发者ID:cchriste,项目名称:visit,代码行数:6,代码来源:visit.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ string_buffer类代码示例发布时间:2022-05-31
下一篇:
C++ stringT类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap