Example #1
0
RTDB_API void PMC_API uninit_rtdb(void)
{
	lock_rtdb(__true, INFINITE);
	RTK_CURSOR hNode;	
	
	close_handle(g_hLocalNode);
	g_hLocalNode = 0;
	
	hNode = open_first_node();
	while( !cursor_is_end(hNode) ){
		cursor_delete(hNode);
		hNode = open_first_node();
	}
	close_handle(hNode);
	unlock_rtdb();
}
Example #2
0
PROXY_API __bool PMC_API discover_nodes_ex(
	__uint timeout, 
	__uint * count,
	__bool bDiscardOld
	)
{
	__uint i;
	if(count){
		*count = 0;
	}
	CDiscoverNodes *eye = new CDiscoverNodes(timeout);
	if(!eye){
		return __false;
	}
	if(!eye->WaitResult()){
		return __false;
	}
	
	if(bDiscardOld){
		// clear database
		if( !lock_rtdb(__true, timeout) ){
			return __false;
		}
		
		RTK_CURSOR	cursor;
		cursor = open_first_node();
		while(cursor){
			cursor_delete(cursor);
			cursor = open_first_node();
		}
		for(i=0; i<eye->c_nodes; i++){
			cursor = create_node(&eye->nodes[i], 0);
			close_handle(cursor);
		}
		unlock_rtdb();
	}

	if(count){
		*count = eye->c_nodes;
	}
	return __true;
}
Example #3
0
void CDCSItem::ReloadContents()
{
    RTK_CURSOR hNode;
    PRTK_NODE  pNode;
    CNodeItem  *item;

    RemoveChildren();
    // discover all running nodes
    // discover_nodes(1000);
    hNode = open_first_node();
    pNode = (PRTK_NODE)cursor_get_item(hNode);
    while( pNode ){
        item = new CNodeItem(&pNode->key);
        AddChild(item);
        cursor_move_next(hNode);
        pNode = (PRTK_NODE)cursor_get_item(hNode);
    }
    close_handle(hNode);
}