本文整理汇总了C++中irept::set方法的典型用法代码示例。如果您正苦于以下问题:C++ irept::set方法的具体用法?C++ irept::set怎么用?C++ irept::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类irept
的用法示例。
在下文中一共展示了irept::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
void jsa_serialisert::operator()(irept &sdu,
const jsa_genetic_solutiont &entity) const
{
sdu.set(FITNESS, entity.fitness);
irept invariant;
irept::subt &invariant_instructions=invariant.get_sub();
for (const jsa_genetic_solutiont::invariantt::value_type &instr : entity.invariant)
{
irept instruction;
instruction.set(OPCODE, instr.opcode);
invariant_instructions.push_back(instruction);
}
sdu.set(INVARIANT, invariant);
irept predicates;
irept::subt &predicates_list=predicates.get_sub();
for (const jsa_genetic_solutiont::predicatet &predicate : entity.predicates)
{
irept pred;
irept::subt &predicate_instructions=pred.get_sub();
for (const jsa_genetic_solutiont::predicatet::value_type &instr : predicate)
{
irept instruction;
instruction.set(OPCODE, instr.opcode);
instruction.set(OP0, instr.op0);
instruction.set(OP1, instr.op1);
instruction.set(RESULT_OP, instr.result_op);
predicate_instructions.push_back(instruction);
}
predicates_list.push_back(pred);
}
sdu.set(PREDICATES, predicates);
irept query;
irept::subt &query_instructions=query.get_sub();
for (const jsa_genetic_solutiont::queryt::value_type &instr : entity.query)
{
irept instruction;
instruction.set(OPCODE, instr.opcode);
instruction.set(OP0, instr.op0);
instruction.set(OP1, instr.op1);
query_instructions.push_back(instruction);
}
sdu.set(QUERY, query);
}
示例2: convert
void convert(const goto_programt::instructiont &instruction, irept &irep)
{
irep.set(ID_code, instruction.code);
if(instruction.function!="")
irep.set(ID_function, instruction.function);
if(instruction.source_location.is_not_nil())
irep.set(ID_location, instruction.source_location);
irep.set(ID_type, (long) instruction.type);
irep.set(ID_guard, instruction.guard);
if(!instruction.targets.empty())
{
irept &tgts=irep.add(ID_targets);
for(goto_programt::targetst::const_iterator it=
instruction.targets.begin();
it!=instruction.targets.end();
it++)
{
irept t(i2string((*it)->location_number));
tgts.move_to_sub(t);
}
}
if(!instruction.labels.empty())
{
irept &lbls = irep.add(ID_labels);
irept::subt &subs = lbls.get_sub();
subs.reserve(instruction.labels.size());
for(goto_programt::instructiont::labelst::const_iterator it=
instruction.labels.begin();
it!=instruction.labels.end();
it++)
{
subs.push_back(irept(*it));
}
}
}