本文整理汇总了C++中Tuple::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Tuple::append方法的具体用法?C++ Tuple::append怎么用?C++ Tuple::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tuple
的用法示例。
在下文中一共展示了Tuple::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseTupleElementType
void parseTupleElementType(){
pos++;
char* type = argv[pos];
std::cout << "Type: " << type << std::cout;
pos++;
char* rawValue = argv[pos];
stringstream ss;
ss << rawValue;
cout << "RawValue: " << rawValue << std::cout;
if(strcmp(type, "i") == 0) {
int intValue;
ss >> intValue;
tuple.append(intValue);
} else if(strcmp(type, "s") == 0) {
示例2: main
int main() {
// Transformation or Data Flow
Relation dataFlow(2,2); // [i,j] -> [i,j]
dataFlow.name_input_var(1, "i");
dataFlow.name_input_var(2, "j");
Variable_ID i = dataFlow.input_var(1);
Variable_ID j = dataFlow.input_var(2);
dataFlow.name_output_var(1, "I");
dataFlow.name_output_var(2, "J");
Variable_ID I = dataFlow.output_var(1);
Variable_ID J = dataFlow.output_var(2);
F_And *root = dataFlow.add_and();
EQ_Handle ieq = root->add_EQ();
ieq.update_coef(i,1);
ieq.update_coef(I,-1);
EQ_Handle jeq = root->add_EQ();
jeq.update_coef(j,1);
jeq.update_coef(J,-1);
// dataFlow.prefix_print();
cout << "Data Flow:\t";
dataFlow.print_with_subs(stdout);
RelTuple R;
R.append(dataFlow);
Relation IS(2);
IS.name_set_var(1, "i");
IS.name_set_var(2, "j");
Free_Var_Decl n("n");
Variable_ID IS_n = IS.get_local(&n);
Variable_ID IS_i = IS.set_var(1);
Variable_ID IS_j = IS.set_var(2);
F_And *IS_root = IS.add_and();
GEQ_Handle imin = IS_root->add_GEQ();
imin.update_coef(IS_i, 1);
imin.update_const(-1);
GEQ_Handle imax = IS_root->add_GEQ();
imax.update_coef(IS_n,1);
imax.update_coef(IS_i, -1);
GEQ_Handle jmin = IS_root->add_GEQ();
jmin.update_coef(IS_j, 1);
jmin.update_const(-1);
GEQ_Handle jmax = IS_root->add_GEQ();
jmax.update_coef(IS_n,1);
jmax.update_coef(IS_j, -1);
cout << "IS:\t\t";
IS.print_with_subs(stdout);
SetTuple S;
S.append(IS);
Relation norm(2);
norm.name_set_var(1, "i");
norm.name_set_var(2, "j");
i = norm.set_var(1);
j = norm.set_var(2);
F_And *norm_root = norm.add_and();
EQ_Handle equal = norm_root->add_EQ();
equal.update_const(0);
cout << "Relation:\t";
norm.print_with_subs(stdout);
// creating MMaps
MMap mmtest; // { [t,i] -> [i,j] , "a" }
//defining mmtest
Relation map(2,2); // making it output 2 vars
map.name_input_var(1, "i");
map.name_input_var(2, "j");
Variable_ID t1 = map.input_var(1);
Variable_ID i1 = map.input_var(2);
map.name_output_var(1, "i");
map.name_output_var(2, "j"); // output var 2
Variable_ID x1 = map.output_var(1);
Variable_ID y1 = map.output_var(2); // output var 2
F_And *map_root = map.add_and();
EQ_Handle map_xeq = map_root->add_EQ(); // x=i === x-i = 0
map_xeq.update_coef(x1,1);
map_xeq.update_coef(t1,-1);
EQ_Handle map_yeq = map_root->add_EQ(); // y=t === y-t = 0
map_yeq.update_coef(y1,1);
map_yeq.update_coef(i1,-1);
mmtest.mapping = map;
mmtest.var = "a";
cout << "Memory Map:\t";
map.print_with_subs(stdout);
//.........这里部分代码省略.........