Пример #1
0
void ListenerAdapter::polkit_qt_listener_initiate_authentication(PolkitAgentListener  *listener,
        const gchar          *action_id,
        const gchar          *message,
        const gchar          *icon_name,
        PolkitDetails        *details,
        const gchar          *cookie,
        GList                *identities,
        GCancellable         *cancellable,
        GSimpleAsyncResult *result)
{
    qDebug() << "polkit_qt_listener_initiate_authentication callback for " << listener;

    PolkitQt1::Identity::List idents;
    PolkitQt1::Details dets(details);

    Listener *list = findListener(listener);

    for (GList *identity = g_list_first(identities); identity != NULL; identity = g_list_next(identity)) {
         idents.append(PolkitQt1::Identity((PolkitIdentity *)identity->data));
    }

    list->initiateAuthentication(QString::fromUtf8(action_id),
                                 QString::fromUtf8(message),
                                 QString::fromUtf8(icon_name),
                                 dets,
                                 QString::fromUtf8(cookie),
                                 idents,
                                 new AsyncResult(result));
}
Пример #2
0
int main(const int argc, const char** argv) {
	double tstart1, tstop1, tstart2, tstop2, tstartall, tstopall;
	
	// start clocking
	tstartall = (double)clock()/(double)CLOCKS_PER_SEC;
	
	// mi will be the cards of the support sets and m is the total card
  std::vector<int> mi;
 	int m;
 	
 	// construct an empty pointset and an index
 	std::vector<std::vector<Field> > pointset;
 	map<std::vector<Field>,int> points_index;
 	
 	//read input (points, mi, m), apply cayley trick 
 	// (now you have the pointset), make the index
 	cayley_trick(pointset, points_index, mi, m);
	
	// compute the big matrix
	// BUT first homogenize the pointset, dirty way..
	vector<vector<Field> > homo_pointset;
	homogenize(pointset,homo_pointset);
	std::cout << homo_pointset << std::endl;
  HD dets(homo_pointset.begin(),homo_pointset.end());
	
	//define the projection
	vector<int> proj = proj_first_coord(PD,m,mi);
	
	// the data structure to hold the res polytope
	int numof_triangs=0, numof_init_Res_vertices;
	Convex_hull_d CH(PD);
	
	//compute the res polytope
	compute_res(pointset,points_index,m,mi,proj,dets,numof_triangs, numof_init_Res_vertices,CH);
	//compute_res_fast(pointset,points_index,m,mi,proj,dets,numof_triangs, numof_init_Res_vertices,CH);
	
	// stop clocking
	tstopall = (double)clock()/(double)CLOCKS_PER_SEC;
	
	// print the vertices of the res polytope
	for (Vertex_iterator_d vit = CH.vertices_begin(); vit != CH.vertices_end(); vit++)
		std::cout << vit->point() << " ";
	std::cout << std::endl;
	
	// print some statistics
	print_statistics(numof_triangs, numof_init_Res_vertices, CH.number_of_vertices(), tstopall-tstartall);
	
	return 0;
}