本文整理汇总了C++中ParameterList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::begin方法的具体用法?C++ ParameterList::begin怎么用?C++ ParameterList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterList
的用法示例。
在下文中一共展示了ParameterList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: same_parameters
bool TypeRegistry::same_parameters(const ParameterList &p1, const ParameterList &p2) const
{
if (p1.size() != p2.size()) return false;
ParameterList::const_iterator j=p2.begin();
for (ParameterList::const_iterator i=p1.begin(); i!=p1.end(); ++i, ++j)
{
if (TypeNameUtils::trim(i->type_specifier) != TypeNameUtils::trim(j->type_specifier))
return false;
}
return true;
}
示例2: haveSameValues
bool Teuchos::haveSameValues( const ParameterList& list1, const ParameterList& list2 )
{
// Check that the top-level names of the two parameter lists are the same
//const std::string ¶mListName1 = list1.name();
//const std::string ¶mListName2 = list2.name();
//if ( paramListName1 != paramListName2 ) {
// return false;
//}
ParameterList::ConstIterator itr1, itr2;
for(
itr1 = list1.begin(), itr2 = list2.begin();
itr1 != list1.end() && itr2 != list2.end();
++itr1, ++itr2
)
{
const std::string &entryName1 = list1.name(itr1);
const std::string &entryName2 = list2.name(itr2);
const ParameterEntry &entry1 = list1.entry(itr1);
const ParameterEntry &entry2 = list2.entry(itr2);
if( entryName1 != entryName2 ) {
return false;
}
if( entry1.isList() && entry2.isList() ) {
if (
!haveSameValues(
getValue<ParameterList>(entry1),
getValue<ParameterList>(entry2))
)
{
// Note: Above we cast to a non-const ParameterList even through we
// only need a const ParameterList. We have to do this since a
// non-const ParameterList is always added initially which determines
// the value.
return false;
}
}
else {
if( entry1.getAny() != entry2.getAny() ) {
return false;
}
}
}
// Check that the two parameter lists are the same length:
if ((itr1 != list1.end()) || (itr2 != list2.end())) {
return false;
}
return true;
}
示例3: f_internalDcop
static ParseNode f_internalDcop(Parser* parser, const ParameterList& params)
{
SpecialFunction function = SpecialInformation::functionObject("DCOP", params[0].toString());
int functionId = SpecialInformation::function(Group::DCOP, params[0].toString());
if (functionId == -1)
return f_executeSlot(parser, params);
//return ParseNode::error("unknown function");
else if ((uint)function.minArg() > params.count() - 1)
return ParseNode::error("too few parameters");
else if ((uint)function.maxArg() < params.count() - 1)
return ParseNode::error("too many parameters");
KommanderWidget* widget = parser->currentWidget();
if (widget)
widget = widget->widgetByName(params[1].toString());
if (!widget)
return ParseNode::error("unknown widget");
QStringList args;
ParameterList::ConstIterator it = params.begin();
++it; // skip function
++it; // skip widget
while (it != params.end())
{
args += (*it).toString();
++it;
}
return widget->handleDCOP(functionId, args);
}
示例4: convertParameterList
XMLObject XMLParameterListWriter::convertParameterList(
const ParameterList& p,
ParameterEntry::ParameterEntryID& idCounter,
EntryIDsMap& entryIDsMap,
const ValidatortoIDMap& validatorIDsMap) const
{
XMLObject rtn(getParameterListTagName());
for (ParameterList::ConstIterator i=p.begin(); i!=p.end(); ++i){
RCP<const ParameterEntry> entry = p.getEntryRCP(i->first);
if(entry->isList()){
XMLObject newPL = convertParameterList(
getValue<ParameterList>(entry),
idCounter,
entryIDsMap,
validatorIDsMap);
newPL.addAttribute(
getNameAttributeName(), p.name(i));
newPL.addAttribute(
ParameterEntryXMLConverter::getIdAttributeName(), idCounter);
entryIDsMap.insert(EntryIDsMap::value_type(entry, idCounter));
rtn.addChild(newPL);
++idCounter;
}
else{
rtn.addChild(ParameterEntryXMLConverterDB::convertEntry(
entry, p.name(i), idCounter, validatorIDsMap));
entryIDsMap.insert(EntryIDsMap::value_type(entry, idCounter));
++idCounter;
}
}
return rtn;
}
示例5: createAnonName
void *
SymbolTableVisitor::visitStreamSpec(StreamSpec *spec)
{
string scope = syms->getScope();
if (spec->getName() == "anon") {
spec->setName( createAnonName() );
syms->setScope("streamit");
}
string name = spec->getName();
syms->addEntry(name, spec, NULL);
syms->pushScope(name);
ParameterList::iterator iter;
ParameterList *pl = spec->getParams();
for (iter = pl->begin(); iter != pl->end(); iter++) {
Parameter *p = *iter;
FEContext *c = spec->getContext();
string n = p->getName();
Type *t = p->getType();
syms->addEntry(p->getName(), (FENode*)(new StmtVarDecl(c, t, n, 0)), 0);
}
FEPrintVisitor::visitStreamSpec(spec);
syms->setScope(scope);
return NULL;
}
示例6: doDialog
void ClsQHarborImpl::doDialog(int iItemType, string strItemID, int iIndex) {
string strItemType;
string strItemName;
string strSubItemName;
ParameterList paramLst;
list<string> lstParams;
if(iItemType == ClsFESystemManager::ITEM_GROUP) {
strItemType = "Group";
clsItem = ClsFESystemManager::Instance()->getFEGroup( strItemID );
if(clsItem!=NULL) {
strItemName = dynamic_cast<ClsFEGroup*>(clsItem)->getGroupName();
ClsNeuron* clsNeuron = dynamic_cast<ClsFEGroup*>(clsItem)->getNeuron( );
if(clsNeuron!=NULL) {
strSubItemName = dynamic_cast<ClsFEGroup*>(clsItem)->getGroupNeuronLabel();
paramLst = clsNeuron->getListParameters();
}
}
} else if (iItemType == ClsFESystemManager::ITEM_CONNECTION) {
strItemType = "Connection";
clsItem = ClsFESystemManager::Instance()->getFEConnection( strItemID );
if(clsItem!=NULL) {
strItemName = dynamic_cast<ClsFEConnection*>(clsItem)->getConnectionName();
ClsSynapse* clsSynapse = dynamic_cast<ClsFEConnection*>(clsItem)->getSynapse( );
if(clsSynapse!=NULL) {
strSubItemName = dynamic_cast<ClsFEConnection*>(clsItem)->getConnectionSynapseLabel();
paramLst = clsSynapse->getListParameters();
}
}
}
for(ParameterList::iterator it=paramLst.begin(); it!=paramLst.end(); it++) {
if(dynamic_cast<ClsDoubleParameter*>(*it)) {
pair<string, string> pairTemp((*it)->getLabel(), (*it)->getName());
mapParams.insert(pairTemp);
lstParams.push_back((*it)->getLabel());
}
}
if(lstParams.size()>0) {
if(iIndex<0) {
qtableEntries->insertRows(0,1);
qtableEntries->setText(0, COL_TYPE, strItemType);
qtableEntries->setText(0, COL_NAME, strItemName);
qtableEntries->setText(0, COL_ID, strItemID);
qtableEntries->setText(0, COL_CHILD, strSubItemName);
}
ClsQHarborDialogImpl* clsQHarborDialogImpl = new ClsQHarborDialogImpl(strItemType, strItemID,
strItemName, strSubItemName,
lstParams, iIndex, this);
connect(clsQHarborDialogImpl, SIGNAL(sigDoItem(string,int)), SLOT(slotDoItem(string,int)));
connect(clsQHarborDialogImpl, SIGNAL(sigDoItemCanceled(int)), SLOT(slotDoItemCanceled(int)));
clsQHarborDialogImpl->show();
}
}
示例7: set
void LCDWidget::set(const ParameterList &pList)
{
ostringstream params;
for (ParameterList::const_iterator it = pList.begin();
it != pList.end(); ++it)
{
params << *it << " ";
}
setWidgetParameters(params.str());
}
示例8:
std::queue<ParameterList> ComparisonHelper::getMetricsToCompare(const ParameterList &pList)
{
// extract all of the metrics to be tested
std::queue<ParameterList> metrics;
for(auto it = pList.begin(); it != pList.end(); ++it) {
if (pList.isSublist(it->first)) {
metrics.push(pList.sublist(it->first));
}
}
return metrics;
}
示例9: run
void BCManager::run()
{
if (jacT != Teuchos::null) isAdjoint = true;
typedef ParameterList::ConstIterator ParamIter;
for (ParamIter i = bcParams.begin(); i != bcParams.end(); ++i)
{
std::string const& name = bcParams.name(i);
Teuchos::ParameterEntry const& entry = bcParams.entry(i);
assert(entry.isList());
applyBC(Teuchos::getValue<ParameterList>(entry));
}
}
示例10: if
bool Teuchos::operator==( const ParameterList& list1, const ParameterList& list2 )
{
// Check that the top-level names of the two parameter lists are the same
//const std::string ¶mListName1 = list1.name();
//const std::string ¶mListName2 = list2.name();
//if ( paramListName1 != paramListName2 ) {
// return false;
//}
ParameterList::ConstIterator itr1, itr2;
for(
itr1 = list1.begin(), itr2 = list2.begin();
itr1 != list1.end() && itr2 != list2.end();
++itr1, ++itr2
)
{
const std::string &entryName1 = list1.name(itr1);
const std::string &entryName2 = list2.name(itr2);
const ParameterEntry &entry1 = list1.entry(itr1);
const ParameterEntry &entry2 = list2.entry(itr2);
if( entryName1 != entryName2 ) {
return false;
}
else if( entry1 != entry2 ) {
return false;
}
// Note that the above statement automatically recursively compare the
// sublists since ParameterList objects are stored in the 'any' variable
// held by the ParameterEntry object and this same comparison operator will
// be used.
}
// Check that the two parameter lists are the same length:
if ((itr1 != list1.end()) || (itr2 != list2.end())) {
return false;
}
return true;
}
示例11: buildInitialValidatorMap
void XMLParameterListWriter::buildInitialValidatorMap(
const ParameterList& p,
ValidatortoIDMap& validatorIDsMap) const
{
for (ParameterList::ConstIterator i=p.begin(); i!=p.end(); ++i) {
const ParameterEntry& entry = p.entry(i);
if(entry.isList()){
buildInitialValidatorMap(
getValue<ParameterList>(entry),
validatorIDsMap);
}
else if(nonnull(entry.validator())){
validatorIDsMap.insert(entry.validator());
}
}
}
示例12: if
void
SexpParser::ListToString(stringstream& ss, const ParameterList& lst)
{
string space;
ss.setf(ios_base::fixed,ios_base::floatfield);
ss.precision(2);
for (
ParameterList::TVector::const_iterator i = lst.begin();
i != lst.end();
++i
)
{
if (i->type() == typeid(string))
{
ss << space;
ss << boost::any_cast<string>(*i);
}
else if (i->type() == typeid(float))
{
ss << space;
ss << boost::any_cast<float>(*i);
}
else if (i->type() == typeid(int))
{
ss << space;
ss <<boost::any_cast<int>(*i);
}
else if (i->type() == typeid(ParameterList))
{
const any* v = &(*i);
const ParameterList* lst = any_cast<ParameterList>(v);
ss << space;
ss << '(';
ListToString(ss,*lst);
ss << ')';
}
else
{
ss << space;
ss << "(error data format unknown)";
}
space = " ";
}
}
示例13: updateParametersFromXmlFile
TEUCHOS_UNIT_TEST( Teuchos_ParameterList, xmlUpdateAndBroadcast ) {
const RCP<const Comm<int> > comm = DefaultComm<int>::getComm();
// Test the broadcast functionality to avoid unscalable I/O collisions
std::string inputFile="input.xml";
ParameterList A;
ParameterList B;
updateParametersFromXmlFile(inputFile, &A);
updateParametersFromXmlFileAndBroadcast(inputFile, &B, *comm);
out << "B = " << B;
TEST_ASSERT( B.begin() != B.end() ); // Avoid false positive from empty lists
// See if any process returned a failed (i.e. a non-zero local_failed)
int local_failed = !(A == B);
int global_failed = -1;
reduceAll( *comm, Teuchos::REDUCE_SUM, local_failed, outArg(global_failed) );
TEST_EQUALITY_CONST( global_failed, 0 );
}
示例14: f_executeSlot
static ParseNode f_executeSlot(Parser* parser, const ParameterList& params)
{
ParameterList::ConstIterator it = params.begin();
QString slotName = (*it).toString()+"(";
++it;
QString widgetName = (*it).toString();
KommanderWidget* widget = parser->currentWidget();
if (!widget)
return ParseNode::error("unknown widget");
widget = widget->widgetByName(widgetName);
if (!widget)
return ParseNode::error("unknown widget");
QObject *object = widget->object();
if (!object)
return ParseNode::error("unknown widget");
QStrList slotSignatures = object->metaObject()->slotNames(true);
QStringList slotNames = QStringList::fromStrList(slotSignatures);
int slotNum = -1;
uint i = 0;
while (i < slotNames.count())
{
if (slotNames[i].startsWith(slotName))
{
slotNum = i;
break;
}
i++;
}
if (slotNum == -1)
return ParseNode::error("unknown function");
QStringList args;
++it; // skip widget
while (it != params.end())
{
args += (*it).toString();
++it;
}
InvokeClass* inv = new InvokeClass(0);
inv->invokeSlot(object, slotSignatures.at(slotNum), args);
inv->deleteLater();
return ParseNode();
}
示例15: LoadMetricInfo
static void LoadMetricInfo(std::vector<MetricAnalyzerInfo> & metricInfoSet,
const RCP<const Zoltan2::EvaluatePartition <basic_id_t> > &metricObject,
const ParameterList &metricsParameters) {
// at this point we should be looking at a metricsPlist with the following format - note that weight is optional
// <ParameterList name="metriccheck1">
// <Parameter name="check" type="string" value="imbalance"/>
// <Parameter name="lower" type="double" value="0.99"/>
// <Parameter name="upper" type="double" value="1.4"/>
// </ParameterList>
// <ParameterList name="metriccheck2">
// <Parameter name="check" type="string" value="imbalance"/>
// <Parameter name="weight" type="int" value="0"/>
// <Parameter name="lower" type="double" value="0.99"/>
// <Parameter name="upper" type="double" value="1.4"/>
// </ParameterList>
// first let's get a list of all the headings, so "metriccheck1", "metriccheck2" in this case
// I've currently got this enforcing those names strictly to make sure formatting is correct
// But really the headings could just be any unique names and are arbitrary
int headingIndex = 1;
for (auto iterateArbitraryHeadingNames = metricsParameters.begin(); iterateArbitraryHeadingNames != metricsParameters.end(); ++iterateArbitraryHeadingNames) {
auto headingName = metricsParameters.name(iterateArbitraryHeadingNames);
// we could be flexible on these headers but for now let's enforce it to get any convention inconsistencies cleaned up
std::string expectedHeadingName = "metriccheck" + std::to_string(headingIndex);
if( expectedHeadingName != headingName) {
throw std::logic_error( "The parameter list expected to find a heading with name '" + expectedHeadingName + "' but instead found '" + headingName );
}
// get the parameters specific to the check we want to run
const ParameterList & metricCheckParameters = metricsParameters.sublist(headingName);
MetricAnalyzerInfo metricInfo = getMetricInfo(metricCheckParameters, metricObject);
metricInfoSet.push_back(metricInfo);
++headingIndex;
}
}