library/src/events/BP-Events.cc
// add processor to the event manager (adds to processor registry)
add processor to the event manager (adds to processor registry)
add processor to the event manager ( adds to processor registry )
BP_ERROR_T BP_EventMgrAddProcessor
(
		P_BP_EVENT_MANAGER mgr,
		char *processor_name,
		char *processor_description,
		BP_EVENT_PROCESSOR_COMPUTE_TARGET_TYPE compute_target_type,
		BP_EVENT_PROCESSOR_FUNC_T processor_entry_point
)
{
	BP_EVENTMGR_VALIDATE_WORKING_ENVIRONMENT(ERR_FAILURE);
	if(!mgr)
		return ERR_FAILURE;
	if(!processor_name)
		return ERR_FAILURE;
	if(!processor_description)
		return ERR_FAILURE;
	char * table_path_actual[10] = {0};
	BP_HASH_TABLE_TRAVERSAL_PATH table_path = (char **) &table_path_actual;
	table_path[0] = "system";
	table_path[1] = "event_managment";
	table_path[2] = mgr->name;
	table_path[3] = "processors";
	table_path[4] = processor_name;
	table_path[5] = NULL;
	BP_HashRegAddTableByPath(NULL,table_path);
	P_BP_HASH_TABLE_KEYED_ENTRY processor_name_lookup = BP_HashRegLookupTableByPath(NULL, table_path);
	if(!processor_name_lookup)
		return ERR_FAILURE;
	table_path[0] = "system";
	table_path[1] = "event_managment";
	table_path[2] = mgr->name;
	table_path[3] = "processors";
	table_path[4] = processor_name;
	table_path[5] = NULL;
	BP_ERROR_T success_fail = BP_HashRegAddDataToTableByPath
	(
		NULL,
		table_path,
		"entry",
		BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB,
		NULL,
		sizeof(BP_EVENT_PROCESSOR)
	);
	if(success_fail == ERR_FAILURE)
		return ERR_FAILURE;
	table_path[0] = "system";
	table_path[1] = "event_managment";
	table_path[2] = mgr->name;
	table_path[3] = "processors";
	table_path[4] = processor_name;
	table_path[5] = "entry";
	table_path[6] = NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY data_name_lookup = BP_HashRegLookupTableEntryByPath(NULL, table_path);
	if(!data_name_lookup)
		return ERR_FAILURE;
	P_BP_EVENT_PROCESSOR new_processor = (P_BP_EVENT_PROCESSOR) data_name_lookup->data;
	if(!new_processor)
		return ERR_FAILURE;
	new_processor->uuid        = NEW_RANDOM_UUID;
	new_processor->name        = bpstrdup(processor_name);
	new_processor->description = bpstrdup(processor_description);
	new_processor->entry_point = processor_entry_point;
	new_processor->compute_target_type = compute_target_type;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_EventMgrAddProcessor ( P_BP_EVENT_MANAGER mgr , char * processor_name , char * processor_description , BP_EVENT_PROCESSOR_COMPUTE_TARGET_TYPE compute_target_type , BP_EVENT_PROCESSOR_FUNC_T processor_entry_point ) { BP_EVENTMGR_VALIDATE_WORKING_ENVIRONMENT ( ERR_FAILURE ) ; if ( ! mgr ) return ERR_FAILURE ; if ( ! processor_name ) return ERR_FAILURE ; if ( ! processor_description ) return ERR_FAILURE ; char * table_path_actual [ 10 ] = { 0 } ; BP_HASH_TABLE_TRAVERSAL_PATH table_path = ( char * * ) & table_path_actual ; table_path [ 0 ] = " " ; table_path [ 1 ] = " " ; table_path [ 2 ] = mgr -> name ; table_path [ 3 ] = " " ; table_path [ 4 ] = processor_name ; table_path [ 5 ] = NULL ; BP_HashRegAddTableByPath ( NULL , table_path ) ; P_BP_HASH_TABLE_KEYED_ENTRY processor_name_lookup = BP_HashRegLookupTableByPath ( NULL , table_path ) ; if ( ! processor_name_lookup ) return ERR_FAILURE ; table_path [ 0 ] = " " ; table_path [ 1 ] = " " ; table_path [ 2 ] = mgr -> name ; table_path [ 3 ] = " " ; table_path [ 4 ] = processor_name ; table_path [ 5 ] = NULL ; BP_ERROR_T success_fail = BP_HashRegAddDataToTableByPath ( NULL , table_path , " " , BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB , NULL , sizeof ( BP_EVENT_PROCESSOR ) ) ; if ( success_fail == ERR_FAILURE ) return ERR_FAILURE ; table_path [ 0 ] = " " ; table_path [ 1 ] = " " ; table_path [ 2 ] = mgr -> name ; table_path [ 3 ] = " " ; table_path [ 4 ] = processor_name ; table_path [ 5 ] = " " ; table_path [ 6 ] = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY data_name_lookup = BP_HashRegLookupTableEntryByPath ( NULL , table_path ) ; if ( ! data_name_lookup ) return ERR_FAILURE ; P_BP_EVENT_PROCESSOR new_processor = ( P_BP_EVENT_PROCESSOR ) data_name_lookup -> data ; if ( ! new_processor ) return ERR_FAILURE ; new_processor -> uuid = NEW_RANDOM_UUID ; new_processor -> name = bpstrdup ( processor_name ) ; new_processor -> description = bpstrdup ( processor_description ) ; new_processor -> entry_point = processor_entry_point ; new_processor -> compute_target_type = compute_target_type ; return ERR_SUCCESS ; }
add processor to the event manager (adds to processor registry)
add processor to the event manager ( adds to processor registry )
// ensure we have a correct working environment within the event manager // ensure we have a manager // ensure we have a name and description // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Create New Processor Entry %%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create a table path on the stack for ease of use // reference to the local stack // add table // add the table path // attempt to lookup the table by path // ensure we have a processor name lookup // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Create New Worker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create table path for adding element // attempt to create new managed worker structure // ensure addition was successful // create table path for lookup // attempt to lookup the table by path // ensure we have a data lookup // dereference data // ensure we have a new processor /*
	P_BP_EVENT_MANAGER mgr,
		char *processor_name,
		char *processor_description,
		BP_EVENT_PROCESSOR_COMPUTE_TARGET_TYPE compute_target_type,
		BP_EVENT_PROCESSOR_CONSUMER_FUNC_T consumer,
		BP_EVENT_PROCESSOR_PRODUCER_FUNC_T producer,
		size_t max_messages_in,
		size_t max_messages_out
	*/ // set new uuid, name, and description // consumer and producer // set compute target type // return indicating success