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


C++ xml::ConstIterator类代码示例

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


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

示例1: readWithSystem

/*!
 *  \brief Read a Factory, obtain selection of default types for the different families.
 *  \param inIter Iterator to the XML node to read the Factory from.
 *  \param ioSystem System to use to read the type selector.
 *  \throw Beagle::IOException If the format is invalid.
 */
void Factory::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Factory")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Factory> expected!");
	}
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="Concept")) {
			std::string lConceptName = lChild->getAttribute("name");
			if(lConceptName.empty()) {
				throw Beagle_IOExceptionNodeM(*lChild, "no name attribute given for current Concept tag!");
			}
			std::string lTypeName = lChild->getAttribute("type");
			if(lTypeName.empty()) {
				throw Beagle_IOExceptionNodeM(*lChild, "no type attribute given for current Concept tag!");
			}
			Factory::AllocatorMap::const_iterator lIterAllocMap = mAllocatorMap.find(lTypeName);
			if(lIterAllocMap == mAllocatorMap.end()) {
				std::ostringstream lOSS;
				lOSS << "Type named '" << lTypeName;
				lOSS << "' does not exists in the internal allocator map of the Factory; ";
				lOSS << "could not associated to concept '" << lConceptName << "'.";
				throw Beagle_IOExceptionNodeM(*lChild, lOSS.str());
			}
			setConcept(lConceptName, lTypeName);
			Beagle_LogTraceM(
			    ioSystem.getLogger(),
			    std::string("Type associated to concept '")+lConceptName+
			    std::string("' is now '")+lTypeName+std::string("'")
			);
		}
	}
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:40,代码来源:Factory.cpp

示例2: readWithSystem

/*!
 * \brief Read object from XML using system.
 * \param inIter XML iterator of input document.
 * \param ioSystem A reference to the system.
 * \throw SCHNAPS::Core::IOException if a wrong tag is encountered.
 * \throw SCHNAPS::Core::IOException if inProbabilities attribute is missing.
 * \throw SCHNAPS::Core::RunTimeException if the primitive is undefined for the specific probabilities source.
 */
void BranchMulti::readWithSystem(PACC::XML::ConstIterator inIter, Core::System& ioSystem) {
	schnaps_StackTraceBeginM();
	if (inIter->getType() != PACC::XML::eData) {
		throw schnaps_IOExceptionNodeM(*inIter, "tag expected!");
	}
	if (inIter->getValue() != getName()) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected, but ";
		lOSS << "got tag <" << inIter->getValue() << "> instead!";
		throw schnaps_IOExceptionNodeM(*inIter, lOSS.str());
	}

	// retrieve probabilities of executing each branch
	if (inIter->getAttribute("inProbabilities").empty()) {
		throw schnaps_IOExceptionNodeM(*inIter, "probabilities of executing each branch expected!");
	}
	mProbabilities_Ref.assign(inIter->getAttribute("inProbabilities"));
	
	switch (mProbabilities_Ref[0]) {
		case '@':
			// individual variable value
		case '#':
			// environment variable value
		case '%':
			// local variable value
			throw schnaps_RunTimeExceptionM("The primitive is undefined for the specific probabilities source!");
			break;
		case '$':
			// parameter value
			mProbabilities = Core::castHandleT<Core::Vector>(ioSystem.getParameters().getParameterHandle(mProbabilities_Ref.substr(1)));
			break;
		default: {
			// direct value
			std::stringstream lISS(mProbabilities_Ref);
			PACC::Tokenizer lTokenizer(lISS);
			lTokenizer.setDelimiters("|", "");
			
			std::string lProbability;
			double lSum = 0;

			mProbabilities = new Core::Vector();
			while (lTokenizer.getNextToken(lProbability)) {
				mProbabilities->push_back(new Core::Double(SCHNAPS::str2dbl(lProbability)));
				lSum += SCHNAPS::str2dbl(lProbability);
			}
			
#ifndef SCHNAPS_NDEBUG
			if (lSum != 1) {
				std::cout << "Warning: multi branches probabilities must sum to 1 (current sum: " <<  lSum << "!";
				std::cout << "\tIn: void SCHNAPS::Plugins::Control::BranchMulti::readWithSystem(PACC::XML::ConstIterator, SCHNAPS::Core::System&)\n";
			}
#endif
			break; }
	}
	setNumberArguments(mProbabilities->size());
	schnaps_StackTraceEndM("void SCHNAPS::Plugins::Control::BranchMulti::readWithSystem(PACC::XML::ConstIterator, SCHNAPS::Core::System&)");
}
开发者ID:audurand,项目名称:schnaps,代码行数:65,代码来源:BranchMulti.cpp

示例3: Beagle_IOExceptionNodeM

/*!
 *  \brief Read an instruction super set from a Beagle XML stream.
 *  \param inIter XML node used to read the super set from.
 *  \throw Beagle::IOException If size atribute not present.
 */
void LinGP::InstructionSuperSet::read(PACC::XML::ConstIterator inIter)
{
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "InstructionSuperSet"))
		throw Beagle_IOExceptionNodeM((*inIter), "tag <InstructionSuperSet> expected!");
	unsigned int lPSIndex = 0;
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="InstructionSet")) {
			mInstructionSets[lPSIndex++]->read(lChild);
		}
	}
}
开发者ID:GhostGambler,项目名称:beagle,代码行数:16,代码来源:InstructionSuperSet.cpp

示例4: Beagle_IOExceptionNodeM

/*!
 *  \brief Read a sigma adaptation operator from a XML subtree.
 *  \param inIter XML iterator to use to read adaptation operator.
 *  \param ioSystem Evolutionary system.
 */
void ES::AdaptOneFifthRuleOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	string lMutateGaussSigmaReadName = inIter->getAttribute("mutgausssigma");
	if(lMutateGaussSigmaReadName.empty() == false) mMutateGaussSigmaName = lMutateGaussSigmaReadName;
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:17,代码来源:AdaptOneFifthRuleOp.cpp

示例5: readWithSystem

/*!
 *  \brief Read a initialization operator from a XML subtree.
 *  \param inIter XML iterator to use to read initialization operator.
 *  \param ioSystem Evolutionary system.
 */
void InitializationOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	std::string mReproProbaReadName = inIter->getAttribute("repropb");
	if(mReproProbaReadName.empty() == false) mReproProbaName = mReproProbaReadName;
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:17,代码来源:InitializationOp.cpp

示例6: Beagle_IOExceptionNodeM

/*!
 *  \brief Read a linear GP mutation operator from XML tree.
 *  \param inNode XML node to use to read mutation operator.
 *  \param ioSystem Evolutionary system.
 */
void LinGP::MutationOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	std::string lMutationPbReadName = inIter->getAttribute("mutationpb");
	if(lMutationPbReadName.empty() == false) mMutationPbName = lMutationPbReadName;
	std::string lInstructMutatePbReadName = inIter->getAttribute("mutinstructpb");
	if(lInstructMutatePbReadName.empty() == false) mInstructMutatePbName = lInstructMutatePbReadName;
}
开发者ID:GhostGambler,项目名称:beagle,代码行数:17,代码来源:MutationOp.cpp

示例7: readWithContext

/*!
 *  \brief Read an individual bag with a context.
 *  \param inIter XML iterator to read the bag from.
 *  \param ioContext Evolutionary context.
 */
void IndividualBag::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="IndividualBag"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <IndividualBag> expected!");
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if(lChild->getType() == PACC::XML::eData) {
			readIndividuals(lChild, ioContext);
			break;
		}
	}
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:18,代码来源:IndividualBag.cpp

示例8:

/*!
 *  \brief Read invoker primitive from XML subtree.
 *  \param inIter XML iterator to read the primitive from.
 *  \param ioContext Evolutionary context.
 */
void GP::Invoker::readWithContext(PACC::XML::ConstIterator inIter, GP::Context& ioContext)
{
	Beagle_StackTraceBeginM();
	GP::Primitive::readWithContext(inIter, ioContext);
	std::string lIndexValue = inIter->getAttribute("id");
	if(lIndexValue.empty()==false) mIndex = str2uint(lIndexValue);
	unsigned int lArgsCount = 0;
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if(lChild->getType()==PACC::XML::eData) ++lArgsCount;
	}
	setNumberArguments(lArgsCount);
	Beagle_StackTraceEndM("void GP::Invoker::readWithContext(PACC::XML::ConstIterator inIter, GP::Context& ioContext)");
}
开发者ID:splodginald,项目名称:MPI-PACC-OpenBeagle,代码行数:18,代码来源:Invoker.cpp

示例9: readWithSystem

/*!
 * \brief Read object from XML using system.
 * \param inIter XML iterator of input document.
 * \param ioSystem A reference to the system.
 * \throw SCHNAPS::Core::IOException if a wrong tag is encountered.
 */
void Primitive::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem) {
	schnaps_StackTraceBeginM();
	if (inIter->getType() != PACC::XML::eData) {
		throw schnaps_IOExceptionNodeM(*inIter, "tag expected!");
	}
	if (inIter->getValue() != getName()) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected, but ";
		lOSS << "got tag <" << inIter->getValue() << "> instead!";
		throw schnaps_IOExceptionNodeM(*inIter, lOSS.str());
	}
	schnaps_StackTraceEndM("void SCHNAPS::Core::Primitive::readWithSystem(PACC::XML::ConstIterator, SCHNAPS::Core::System&)");
}
开发者ID:audurand,项目名称:schnaps,代码行数:19,代码来源:Primitive.cpp

示例10: readWithSystem

/*!
 *  \brief Read a recombination operator from XML tree.
 *  \param inIter XML iterator to use to read recombination operator.
 *  \param ioSystem Evolutionary system.
 */
void RecombinationOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	std::string lRecombProbaReadName = inIter->getAttribute("recombpb");
	if(lRecombProbaReadName.empty()==false) mRecombProbaName = lRecombProbaReadName;
	std::string lNumberRecombReadName = inIter->getAttribute("nbrindrecomb");
	if(lNumberRecombReadName.empty()==false) mNumberRecombName = lNumberRecombReadName;
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:19,代码来源:RecombinationOp.cpp

示例11: Beagle_IOExceptionNodeM

/*!
 *  \brief Read a bit flip mutation operator from XML subtree.
 *  \param inIter XML iterator to use to read mutation operator.
 *  \param ioSystem Evolutionary system.
 */
void BitStr::MutationFlipBitOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	std::string lMutationPbReadName = inIter->getAttribute("mutationpb");
	if(lMutationPbReadName.empty() == false) mMutationPbName = lMutationPbReadName;
	std::string lBitMutatePbReadName = inIter->getAttribute("mutbitpb");
	if(lBitMutatePbReadName.empty() == false) mBitMutatePbName = lBitMutatePbReadName;
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:19,代码来源:MutationFlipBitOp.cpp

示例12: readWithSystem

/*!
 *  \brief Read a OversizeOp operator for XML tree.
 *  \param inIter XML iterator to use to read OversizeOp operator.
 *  \param ioSystem Evolutionary system.
 */
void OversizeOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	string lOversizeRatioReadName = inIter->getAttribute("ratio_name");
	if(lOversizeRatioReadName.empty() == false) mOversizeRatioName = lOversizeRatioReadName;
	
	ReplacementStrategyOp::readWithSystem(inIter, ioSystem);
	Beagle_StackTraceEndM("void OversizeOp::readWithSystem(PACC::XML::ConstIterator, System&)");
}
开发者ID:splodginald,项目名称:MPI-PACC-OpenBeagle,代码行数:19,代码来源:OversizeOp.cpp

示例13: Beagle_IOExceptionNodeM

/*!
 *  \brief Read a mutation operator from XML subtree.
 *  \param inIter XML iterator to use to read crossover operator.
 *  \param ioSystem Evolutionary system.
 */
void GP::MutationSwapSubtreeOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	std::string mMutationPbReadName = inIter->getAttribute("mutationpb");
	if(mMutationPbReadName.empty() == false) mMutationPbName = mMutationPbReadName;
	std::string mDistribPbReadName = inIter->getAttribute("distrpb");
	if(mDistribPbReadName.empty() == false) mDistribPbName = mDistribPbReadName;
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:19,代码来源:MutationSwapSubtreeOp.cpp

示例14: readWithContext

/*!
 *  \brief Read genotype from a Beagle XML node.
 *  \param inIter XML iterator to read the genotype from.
 *  \param ioContext Evolutionary context.
 */
void Genotype::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "Genotype")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Genotype> expected!");
	}
	std::string lGenotypeType = inIter->getAttribute("type");
	if((lGenotypeType.empty() == false) && (lGenotypeType != getType())) {
		std::ostringstream lOSS;
		lOSS << "type given '" << lGenotypeType << "' mismatch type of the genotype '";
		lOSS << getType() << "'!";
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	Beagle_StackTraceEndM("void Genotype::readWithContext(PACC::XML::ConstIterator,Context&)");
}
开发者ID:splodginald,项目名称:MPI-PACC-OpenBeagle,代码行数:20,代码来源:Genotype.cpp

示例15: readWithSystem

/*!
 *  \brief Read a max fitness termination operator from a XML subtree.
 *  \param inIter XML iterator from which the operator is read.
 *  \param ioSystem Evolutionary system.
 *  \throw IOException If a reading error occurs.
 */
void TermMaxFitnessOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
		std::ostringstream lOSS;
		lOSS << "tag <" << getName() << "> expected!" << std::flush;
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	std::string lFitnessStr = inIter->getAttribute("fitness");
	if(lFitnessStr.empty() == false) {
		mMaxFitnessDefault = str2dbl(lFitnessStr);
		if(mMaxFitness != NULL) mMaxFitness->getWrappedValue() = mMaxFitnessDefault;
	}
	Beagle_StackTraceEndM();
}
开发者ID:AngelGate,项目名称:beagle,代码行数:21,代码来源:TermMaxFitnessOp.cpp


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