当前位置: 首页>>代码示例>>C++>>正文


C++ dictionary_get函数代码示例

本文整理汇总了C++中dictionary_get函数的典型用法代码示例。如果您正苦于以下问题:C++ dictionary_get函数的具体用法?C++ dictionary_get怎么用?C++ dictionary_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dictionary_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deferred_renderer_use_material

static void deferred_renderer_use_material(material* mat, shader_program* PROG) {
  
  /* Set material parameters */
  
  int tex_counter = 0;
  
  for(int i = 0; i < mat->keys->num_items; i++) {
    char* key = list_get(mat->keys, i);
    
    int* type = dictionary_get(mat->types, key);
    void* property = dictionary_get(mat->properties, key);
    
    GLint loc = glGetUniformLocation(shader_program_handle(PROG), key);
    
    GLint world_matrix_u = glGetUniformLocation(shader_program_handle(PROG), "world_matrix");
    glUniformMatrix4fv(world_matrix_u, 1, 0, WORLD_MATRIX);
  
    GLint proj_matrix_u = glGetUniformLocation(shader_program_handle(PROG), "proj_matrix");
    glUniformMatrix4fv(proj_matrix_u, 1, 0, PROJ_MATRIX);
    
    GLint view_matrix_u = glGetUniformLocation(shader_program_handle(PROG), "view_matrix");
    glUniformMatrix4fv(view_matrix_u, 1, 0, VIEW_MATRIX);
    
    if (*type == mat_type_texture) {
    
      glUniform1i(loc, tex_counter);
      glActiveTexture(GL_TEXTURE0 + tex_counter);
      glBindTexture(GL_TEXTURE_2D, texture_handle(property));
      tex_counter++;
    
    } else if (*type == mat_type_int) {
      
      glUniform1i(loc, *((int*)property));
    
    } else if (*type == mat_type_float) {
    
      glUniform1f(loc, *((float*)property));
      
    } else if (*type == mat_type_vector2) {
    
      vector2 v = *((vector2*)property);
      glUniform2f(loc, v.x, v.y);
    
    } else if (*type == mat_type_vector3) {
    
      vector3 v = *((vector3*)property);
      glUniform3f(loc, v.x, v.y, v.z);
  
    } else if (*type == mat_type_vector4) {
    
      vector4 v = *((vector4*)property);
      glUniform4f(loc, v.w, v.x, v.y, v.z);
    
    } else {
      /* Do nothing */
    }
     
  }  

}
开发者ID:Bevilacqua,项目名称:Corange,代码行数:60,代码来源:deferred_renderer.c

示例2: eu_decode

void eu_decode(char *operation_code) {
if((Instruccion = dictionary_get(SetInstruccionesDeUsuario,operation_code)) == NULL)
if(!Registros.K || (Instruccion = dictionary_get(SetInstruccionesProtegidas,operation_code)) == NULL) {
puts("ERROR: Instrucción inválida.");
exit(EXIT_FAILURE);
}
Parametros = list_create();
}
开发者ID:mllanos,项目名称:tp-2014-2c-enjags-not-just-a-group-rafaga,代码行数:8,代码来源:execution_unit.c

示例3: ansisop_wait

int ansisop_wait (int socket_local, int pid_local){
	int* tamanioNombreWS = recibirCpu(socket_local,sizeof(int),pid_local);
	char* nombreSemaforo = recibirCpu(socket_local,*tamanioNombreWS,pid_local);
	pcb_t* pcb_elegido = recibirPCBdeCPU(socket_local,pid_local);
	int retorno=0;
	t_datos_samaforos* datos_sem;
	t_sock_mje* socketConsola;

	int esEl_Pid(pcb_t* pcb_compara) {
			return (*pcb_compara->PID==pid_local);
	}

	datos_sem = dictionary_get(reg_config.dic_semaforos,nombreSemaforo);
	pthread_mutex_lock(&datos_sem->semsem);
	if (datos_sem->valor > 0 && list_is_empty(datos_sem->cola_procesos)){
		(datos_sem->valor)-- ;
		retorno=0;
	}
	else if (datos_sem->valor <= 0) { // Bloqueo el proceso

		pthread_mutex_lock(&sem_l_Exec);
			list_remove_by_condition(proc_Exec, (void*) esEl_Pid);
			log_debug(logger, "PCB con PID %d sacado de EXEC x bloqueo de Semaforo",pid_local);
		pthread_mutex_unlock(&sem_l_Exec);

		pthread_mutex_lock(&sem_pid_consola);
				socketConsola = dictionary_get(dict_pid_consola,&pid_local);
		pthread_mutex_unlock(&sem_pid_consola);

		if (socketConsola->proc_status==0){
			t_pcb_bloqueado* elem_block = malloc(sizeof(t_pcb_bloqueado));
			elem_block->pcb_bloqueado = pcb_elegido;
			elem_block->tipo_de_bloqueo = 2;
			elem_block->dispositivo = nombreSemaforo;
			elem_block->unidades = 0;
			pthread_mutex_lock(&sem_l_Block); // se bloquea
				list_add(proc_Block, elem_block);
				log_debug(logger, "PCB con PID %d pasado a cola BLOCK",pid_local);
			pthread_mutex_unlock(&sem_l_Block);
			sem_post(&sem_BLOCK_dispo);
		}
		else{
			pthread_mutex_lock(&sem_l_Reject);
				list_add(proc_Reject, pcb_elegido);
				log_debug(logger, "PCB con PID %d pasado a REJECT xfin de consola",pid_local);
			pthread_mutex_unlock(&sem_l_Reject);
			sem_post(&sem_REJECT_dispo);
		}

		retorno = 1; // retorna 1 si se bloquea el proceso para que cambie de PCB
	}
	pthread_mutex_unlock(&datos_sem->semsem);
	return retorno;
}
开发者ID:catalafederico,项目名称:Operativos,代码行数:54,代码来源:procesosCPU.c

示例4: log_debug

//*********************************************************************************************
void *administrar_cola_Block(){
	log_debug(log_procesador_Block, "administrar_cola_Block esta corriendo");

	t_sock_mje* socketConsola;
	t_pcb_bloqueado* elem_block;
	t_datos_dicIO* datos_io;
	t_datos_samaforos* datos_sem;
	int pid_local = 0;
	while (1){
		sem_wait(&sem_BLOCK_dispo); // espero que haya un proceso en BLOCK disponible
		log_debug(log_procesador_Block, "Se empezo a procesar un PCB de BLOCK");

		pthread_mutex_lock(&sem_l_Block);
			elem_block=list_remove(proc_Block, 0);
			pid_local=*(elem_block->pcb_bloqueado->PID);
			log_debug(logger, "PCB con PID %d sacado de cola BLOCK",pid_local);
		pthread_mutex_unlock(&sem_l_Block);

		pthread_mutex_lock(&sem_pid_consola);
				socketConsola = dictionary_get(dict_pid_consola,&pid_local);
		pthread_mutex_unlock(&sem_pid_consola);

		if (socketConsola->proc_status==0){
			switch((elem_block->tipo_de_bloqueo)){
				case 1:	// bloqueo por IO
					pthread_mutex_lock(&sem_reg_config);
						datos_io=dictionary_get(reg_config.dic_IO,elem_block->dispositivo);
						list_add(datos_io->cola_procesos,elem_block);
						sem_post(&(datos_io->sem_dispositivo)); // ver si hay que usar el &
						//dictionary_put(reg_config.dic_IO,elem_block->dispositivo,datos_io); //verr No hace falta hacer un put ya q cuando lo modificas
						//se guarda igual por ser puntero
					pthread_mutex_unlock(&sem_reg_config);
					log_debug(logger, "PCB con PID %d pasado a cola de dispositivo",pid_local);
					break;
				case 2:	// bloqueo por wait
					datos_sem=dictionary_get(reg_config.dic_semaforos,elem_block->dispositivo);
					pthread_mutex_lock(&datos_sem->semsem);
						list_add(datos_sem->cola_procesos,elem_block);
						sem_post(&datos_sem->sem_semaforos);
					pthread_mutex_unlock(&datos_sem->semsem);
					log_debug(logger, "PCB con PID %d pasado a cola de semaforos",pid_local);
					break;
			}
		}
		else{
			pthread_mutex_lock(&sem_l_Reject);
				list_add(proc_Reject, elem_block->pcb_bloqueado);
				log_debug(logger, "PCB con PID %d pasado a REJECT xfin de consola",pid_local);
			pthread_mutex_unlock(&sem_l_Reject);
			sem_post(&sem_REJECT_dispo);
		}
	}

}
开发者ID:catalafederico,项目名称:Operativos,代码行数:55,代码来源:nucleo.c

示例5: ui_elem_get_as_type_id

ui_elem* ui_elem_get_as_type_id(char* name, int type_id) {

  if ( !ui_elem_exists(name) ) {
    error("UI element %s does not exist!", name);
  }
  
  int* ui_elem_type = dictionary_get(ui_elem_types, name);
  
  if (*ui_elem_type != type_id) {
    error("UI element %s was created/added as a %s, but you requested it as a %s!", name, type_id_name(*ui_elem_type), type_id_name(type_id));
  }
  
  return dictionary_get(ui_elems, name);

}
开发者ID:RicoP,项目名称:Corange,代码行数:15,代码来源:ui_manager.c

示例6: ui_elem_exists

bool ui_elem_exists(char* name) {
  if (dictionary_get(ui_elems, name)) {
    return true;
  } else {
    return false;
  }
}
开发者ID:RicoP,项目名称:Corange,代码行数:7,代码来源:ui_manager.c

示例7: debug

// this function is needed to change the name of a PERSON_URL
REGISTRY_PERSON_URL *registry_person_url_reallocate(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, REGISTRY_URL *u, char *name, size_t namelen, time_t when, REGISTRY_PERSON_URL *pu) {
    debug(D_REGISTRY, "registry_person_url_reallocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, u->url, sizeof(REGISTRY_PERSON_URL) + namelen);

    // keep a backup
    REGISTRY_PERSON_URL pu2 = {
            .first_t = pu->first_t,
            .last_t = pu->last_t,
            .usages = pu->usages,
            .flags = pu->flags,
            .machine = pu->machine,
            .machine_name = ""
    };

    // remove the existing one from the index
    registry_person_url_free(p, pu);
    pu = &pu2;

    // allocate a new one
    REGISTRY_PERSON_URL *tpu = registry_person_url_allocate(p, m, u, name, namelen, when);
    tpu->first_t = pu->first_t;
    tpu->last_t = pu->last_t;
    tpu->usages = pu->usages;
    tpu->flags = pu->flags;

    return tpu;
}


// ----------------------------------------------------------------------------
// PERSON

REGISTRY_PERSON *registry_person_find(const char *person_guid) {
    debug(D_REGISTRY, "Registry: registry_person_find('%s')", person_guid);
    return dictionary_get(registry.persons, person_guid);
}
开发者ID:darrentangdt,项目名称:netdata,代码行数:36,代码来源:registry_person.c

示例8: thread_job_function

void thread_job_function(void* param){
	int fd_filesystem;
	extern pthread_mutex_t pedido_filesystem;
	t_msjcxd* mensaje_recv;
	t_msjcxd* mensaje_send;
	t_arg_thread_job* arg;
	arg = (t_arg_thread_job*) param;

	fd_filesystem = arg->fd_filesystem;

	mensaje_recv = recvMsj(arg->fd_job);
	if( strcmp(mensaje_recv->action, "conexion_cerrada") != 0 ){ // tenemos mensaje de job
		if( strcmp(mensaje_recv->action, "inicio_pedido") != 0 ){
			pthread_mutex_lock( &pedido_filesystem );
			mensaje_send = iniciarMsj("info_archivo");
			agregarInfo(mensaje_send, "arch_name", dictionary_get(mensaje_recv->properties, "arch_name"));
			sendMsj(mensaje_send, fd_filesystem);
			/* Recivir info de FS */
			pthread_mutex_unlock( &pedido_filesystem );
			/* (...) */
		}
	}else{ // conexión cerrada por el job
		// ...
		/*pthread_mutex_lock( &pantalla );
		printf("Conexion cerrada (thread_id: %ld).\n", pthread_self());
		pthread_mutex_unlock( &pantalla );*/
		close(arg->fd_job);
	}
}
开发者ID:gdpepp,项目名称:SO-tp-2015-1c,代码行数:29,代码来源:thread_job.c

示例9: debug

REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when) {
    debug(D_REGISTRY, "registry_machine_link_to_url('%s', '%s'): searching for URL in machine", m->guid, u->url);

    REGISTRY_MACHINE_URL *mu = dictionary_get(m->machine_urls, u->url);
    if(!mu) {
        debug(D_REGISTRY, "registry_machine_link_to_url('%s', '%s'): not found", m->guid, u->url);
        mu = registry_machine_url_allocate(m, u, when);
        registry.machines_urls_count++;
    }
    else {
        debug(D_REGISTRY, "registry_machine_link_to_url('%s', '%s'): found", m->guid, u->url);
        mu->usages++;
        if(likely(mu->last_t < (uint32_t)when)) mu->last_t = (uint32_t)when;
    }

    m->usages++;
    if(likely(m->last_t < (uint32_t)when)) m->last_t = (uint32_t)when;

    if(mu->flags & REGISTRY_URL_FLAGS_EXPIRED) {
        debug(D_REGISTRY, "registry_machine_link_to_url('%s', '%s'): accessing an expired URL.", m->guid, u->url);
        mu->flags &= ~REGISTRY_URL_FLAGS_EXPIRED;
    }

    return mu;
}
开发者ID:FedericoCeratto,项目名称:netdata,代码行数:25,代码来源:registry_machine.c

示例10: obtenerDatoLimpioDelDiccionario

char* obtenerDatoLimpioDelDiccionario(t_dictionary* diccionario, char* dato) {

	char* datoProvisorio;
	char* datoLimpio;
	datoProvisorio = dictionary_get(diccionario, dato);
	datoLimpio = string_substring_until(datoProvisorio,(string_length(datoProvisorio) - 1));
	return datoLimpio;
}
开发者ID:Leonardo-Rocca,项目名称:TP-MaRTA,代码行数:8,代码来源:mensajesNodo.c

示例11: iniparser_getstring

/*--------------------------------------------------------------------------*/
char * iniparser_getstring(dictionary * d, char * key, char * def)
{
    char lc_key[ASCIILINESZ+1];

    if (d==NULL || key==NULL)
        return def ;
    return dictionary_get(d, strlwc(key, lc_key), def);
}
开发者ID:Openwsman,项目名称:openwsman,代码行数:9,代码来源:iniparser.c

示例12: signalRequest

void signalRequest(t_nodo_proceso_ejecutando* procesoEjecutando,
		struct pollfd** socketsCPU, int* cantSocketsCpu, t_datosEnviar* paquete)
{
	t_semaforo* semaforo = dictionary_get(dictionarySemaphores, paquete->data);
	debugTrackPCP("Process sent a signal request on semaphore %s .",
			(char*) paquete->data);
	semaforo_signal(semaforo);
}
开发者ID:ferjjp,项目名称:personalCopyTP,代码行数:8,代码来源:accionesParaCPU.c

示例13: ui_render

void ui_render() {

  for(int i = 0; i < ui_elem_names->num_items; i++) {
    char* name = list_get(ui_elem_names, i);
    int* type_id = dictionary_get(ui_elem_types, name);
    ui_elem_render(name);
  }

}
开发者ID:RicoP,项目名称:Corange,代码行数:9,代码来源:ui_manager.c

示例14: ui_elem_get

ui_elem* ui_elem_get(char* name) {

  if ( !ui_elem_exists(name) ) {
    error("UI element %s does not exist!", name);
  }
  
  return dictionary_get(ui_elems, name);

}
开发者ID:RicoP,项目名称:Corange,代码行数:9,代码来源:ui_manager.c

示例15: dictionary_getchar

/*--------------------------------------------------------------------------*/
char dictionary_getchar(dictionary * d, char * key, char def)
{
	char * v ;

	if ((v=dictionary_get(d,key,DICT_INVALID_KEY))==DICT_INVALID_KEY) {
		return def ;
	} else {
		return v[0] ;
	}
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:11,代码来源:dictionary.c


注:本文中的dictionary_get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。