Esempio n. 1
0
void menuLibro(){
	Graph *Artistas = NULL, *LartistasRelacionados = NULL;
	List *Lalbum = NULL, *Lcancion = NULL, *LcancionesTOP = NULL;
	List *Lartistas = NULL, *LartistasTOP = NULL;
	int op1 = 0;

	Lalbum = listNew();
	Lcancion = listNew();
	LcancionesTOP = listNew();
	Lartistas = listNew();
	LartistasTOP = listNew();

	Artistas = graphNew();
	LartistasRelacionados = graphNew();
	Artistas = LlenarGraphArtistas(LlenarLAlbum(LlenarLCanciones()));

	system("cls");
	printf("\t\tESTRUCTURAS DE DATOS\n\nCinthya Gonzalez                                  *       *\nDaniela Andrade                                   *       *\nGisell Litardo                                 *  *       *  *\nCristina Penafiel                              *  *       *  *\n                                               *  *       *  *\n                                               *             *\n                                               *             *\n                                               *             *\n                                               ***************\n");
	_getch();

	do
	{
		do
		{
			system("cls");
			printf("\tBIBLIOTECA DE LIBROS\n\n");
			ListaArtistasPrint(Artistas);
			printf("\n");
			printf("1.-Desea escribir el nombre de un libro\n");
			printf("2.-TOP 10 de libro\n");
			printf("3.-TOP 10 de autores de libro\n");
			printf("4.-Salir\n");
			op1 = getch() - 48;

			switch (op1)
			{
			case 1:
			{
				busquedaNombreArtista(&op1, Artistas, LartistasRelacionados, Lalbum, Lcancion);
				_getch();
			}break;
			case 2:
			{
				topCanciones(Artistas, Lcancion, LcancionesTOP);
				_getch();
			}break;
			case 3:
			{
				topArtistas(Artistas, Lartistas, LartistasTOP);
				_getch();
			}break;
			}
		} while (op1<1 || op1>4);
	} while (op1 != 4);

}
Esempio n. 2
0
bool eventServerInit(EventServer *self, EventServerStartupInfo *info, ServerType serverType) {
    memcpy(&self->info, info, sizeof(self->info));

    // create a unique publisher for the EventServer
    if (!(self->eventsInput = zsock_new(ZMQ_SUB))) {
        error("Cannot allocate a new Server SUBSCRIBER");
        return false;
    }

    // create a connection to the router
    if (!(self->router = zsock_new(ZMQ_PUB))) {
        error("Cannot create zsock to the router.");
        return false;
    }

    // initialize Redis connection
    if (!(self->redis = redisNew(&info->redisInfo))) {
        error("Cannot initialize a new Redis connection.");
        return false;
    }

    // initialize hashtable of clients around
    if (!(self->clientsGraph = graphNew())) {
        error("Cannot allocate a new clients Graph.");
        return false;
    }

    switch (serverType)
    {
        case SERVER_TYPE_BARRACK:
            self->eventServerProcess = barrackEventServerProcess;
            break;
        case SERVER_TYPE_SOCIAL:
            // self->eventServerProcess = socialEventServerProcess;
            break;
        case SERVER_TYPE_ZONE:
            self->eventServerProcess = zoneEventServerProcess;
            break;
        default:
            // No EventServer registred for this server
        break;
    }

    return true;
}