本文整理汇总了C++中InternalNode::getNum方法的典型用法代码示例。如果您正苦于以下问题:C++ InternalNode::getNum方法的具体用法?C++ InternalNode::getNum怎么用?C++ InternalNode::getNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternalNode
的用法示例。
在下文中一共展示了InternalNode::getNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compute_node
void CipherText::compute_node(element_t& v, Node* node){//v amounts to s
if(node->getType() == LEAF){
Leaf* leaf = (Leaf*)node;
leaf->compute(&v, this->pub, this->p);
// printf("leaf: %d, %d, computed\n", leaf->getK(), leaf->getNum());
} else if (node->getType() == INTERNAL_NODE){
InternalNode* internalNode = (InternalNode*)node;
int num = internalNode->getNum();
int k = internalNode->getK();
Node** sons = internalNode->getSons();//??
// printf("internal Node: %d, %d\n", k, num);
element_t* ys = (element_t*)malloc(sizeof(element_t) * (num + 1));
element_init_Zr(ys[0], *(this->p));
element_set(ys[0], v); //set ys[0] to v
computePoints(ys, k, num); //compute other num point,
int i = 1;
for (i = 1; i <= num; i++){
compute_node(ys[i], sons[i - 1]);
}
}
}
示例2: printf
Policy::Policy(unsigned char* buf, pairing_t* p) {
//get nodeNum
int pos = 0;
int numberOfNode = Utility::str2int(buf);
pos += 4;
// printf("node num is %d\n", numberOfNode);
this->nodeNum = numberOfNode;
//reconstruct access tree form bytes
Node** nodes = (Node**)malloc(sizeof(Node*) * this->nodeNum); //store all nodes
int index = 0;
Node* node = NULL;
int nodeSize = 0;
for(index = 0; index < numberOfNode; index++){
printf("index: %d\n", index);
//get father position
int father = Utility::str2int(buf + pos);
pos += 4;
printf("father is %d\t", father);
//get node size to indentify node type
nodeSize = Utility::str2int(buf + pos);
pos += 4;
//printf("node size is %d\t", nodeSize);
if(nodeSize == -1){
nodeSize = INTERNAL_NODE_SIZE;
node = new InternalNode(buf + pos);
printf("internal node\t");
InternalNode* t = (InternalNode*)node;
printf("%d, %d\t", t->getK(), t->getNum());
} else if(nodeSize == -2){
nodeSize = LEAF_SIZE;
node = new Leaf(buf + pos, p);
// printf("leaf\t");
} else {
node = new ExLeaf((char*)(buf + pos), nodeSize);
// printf("ex leaf\t");
}
pos += nodeSize;
nodes[index] = node;
if(father == -1){
this->root = node;
} else {
this->addSon(nodes[father],node);
}
// printf("add son to node %d\n", father);
}
// printf("reconstruct node ok\n");
free(nodes);
}