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


C++ NN函数代码示例

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


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

示例1: _Object_IsA

/*****************************************************************************
 * _Object_IsA
 *****************************************************************************/
bool
_Object_IsA (const void* const objptr, const Object_Class* searched_class)
{
	if (objptr && searched_class) {
		const Object* const obj = (const Object*) objptr;
		const Object_Class* const objclass = OBJECT_GET_CLASS(obj);

		if (objclass == NULL || objclass->magic != CLASS_MAGIC) {
			Log_Printf (LOG_ERROR, 
				    "Object_IsA : not an object ; "
				    "memory might be corrupted !!");
			return false; // ---------->
		}
    
#if 0
		Log_Printf (LOG_DEBUG, "Object_IsA : '%s' isa '%s' ?", 
			    NN(objclass->name), NN(searched_class->name));
#endif

		register const Object_Class* c = objclass;
		while (c) {
			if (c == searched_class)
				return true; // ---------->
			c = c->super;
		}  
		
		Log_Printf (LOG_ERROR, "Object_IsA : '%s' is not a '%s' ", 
			    NN(objclass->name), NN(searched_class->name));
	}
	return false;
}
开发者ID:f1vefour,项目名称:djmount,代码行数:34,代码来源:object.c

示例2: icontainer_real_current

static void 
icontainer_real_current( iContainer *parent, iContainer *child )
{
	iContainer *old_current;

	g_assert( IS_ICONTAINER( parent ) );
	g_assert( !child || IS_ICONTAINER( child ) );
	g_assert( !child || ICONTAINER_IS_CHILD( parent, child ) );

#ifdef DEBUG
	printf( "icontainer_real_current: parent %s \"%s\"; "
		"child %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( parent ), NN( IOBJECT( parent )->name ),
		child ? G_OBJECT_TYPE_NAME( child ) : "NULL", 
		child ? NN( IOBJECT( child )->name ) : "NULL" );
#endif /*DEBUG*/

	old_current = parent->current;
	parent->current = child;

	if( old_current != child ) {
		if( old_current )
			iobject_changed( IOBJECT( old_current ) );
		if( child )
			iobject_changed( IOBJECT( child ) );
		iobject_changed( IOBJECT( parent ) );
	}

	if( child )
		model_front( MODEL( child ) );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:31,代码来源:icontainer.c

示例3: process_colors

void process_colors()
{
    for (int i = 0; metadata_attr_by_object_type[i] != NULL; ++i)
    {
        sai_object_type_t ot = (sai_object_type_t)i;

        bool is_source = source.find(ot) != source.end();
        bool is_target = target.find(ot) != target.end();


        if (is_source && is_target)
        {
            // node is target and source, so it's in the middle
            std::cout << NN(ot) << " [color=\"0.650 0.500 1.000\"];\n";
        }
        else if (is_target)
        {
            // this node is a leaf
            std::cout << NN(ot) << " [color=\"0.355 0.563 1.000\", shape = rect];\n";

        }
        else if (is_source)
        {
            std::cout << NN(ot) << " [color=\"0.650 0.200 1.000\"];\n";
        }
        else
        {
            if (ot == SAI_OBJECT_TYPE_NULL || ot == SAI_OBJECT_TYPE_MAX)
            {
                continue;
            }
            std::cout << NN(ot) << " [color=plum, shape = rect];\n";
        }
    }
}
开发者ID:zubinshah,项目名称:SAI,代码行数:35,代码来源:saidepgraphgen.cpp

示例4: icontainer_real_child_remove

static void 
icontainer_real_child_remove( iContainer *parent, iContainer *child )
{
	iContainerClass *icontainer_child_class = ICONTAINER_GET_CLASS( child );

	g_assert( IS_ICONTAINER( parent ) && IS_ICONTAINER( child ) );

#ifdef DEBUG
	printf( "icontainer_real_child_remove: parent %s \"%s\"; "
		"child %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( parent ), NN( IOBJECT( parent )->name ),
		G_OBJECT_TYPE_NAME( child ), NN( IOBJECT( child )->name ) );
#endif /*DEBUG*/

	if( parent->current == child )
		icontainer_current( parent, NULL ); 

	/* We're about to break the link ... trigger the parent_remove() on 
	 * the child.
	 */
	icontainer_child_class->parent_remove( child );

	icontainer_unlink( child ); 

	UNREF( child );

	iobject_changed( IOBJECT( parent ) );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:28,代码来源:icontainer.c

示例5: print_field_fn

static void *
print_field_fn( IMAGE *im, const char *field, GValue *value )
{
	const char *extra;
	char *str_value;

	str_value = g_strdup_value_contents( value );
	printf( "%s: %s", field, str_value );
	g_free( str_value );

	/* Replace NULL static strings with "(null)".
	 */
#define NN( X ) ((X) ? (X) : "(null)")

	/* Look for known enums and decode them.
	 */
	extra = NULL;
	if( strcmp( field, "Coding" ) == 0 )
		extra = NN( im_Coding2char( g_value_get_int( value ) ) );
	else if( strcmp( field, "BandFmt" ) == 0 )
		extra = NN( im_BandFmt2char( g_value_get_int( value ) ) );
	else if( strcmp( field, "Type" ) == 0 )
		extra = NN( im_Type2char( g_value_get_int( value ) ) );
	else if( strcmp( field, "Compression" ) == 0 )
		extra = NN( im_Compression2char( g_value_get_int( value ) ) );

	if( extra )
		printf( " - %s", extra );

	printf( "\n" );

	return( NULL );
}
开发者ID:anasazi,项目名称:POP-REU-Project,代码行数:33,代码来源:im_printdesc.c

示例6: gfire_read_attrib

GList *gfire_read_buddy_status(PurpleConnection *gc, int packet_len)
{
	int index = XFIRE_HEADER_LEN + 1;
	int itmp = 0;
	GList *btmp = NULL;
	gfire_buddy *gf_buddy = NULL;
	GList *ret = NULL;
	GList *sids = NULL;
	GList *msgs = NULL;
	GList *s, *m; 
	gfire_data *gfire = (gfire_data *)gc->proto_data;

	itmp = gfire_read_attrib(&sids, gfire->buff_in + index, packet_len - index, "sid", FALSE, TRUE, 0, 0, 
							XFIRE_SID_LEN);
	if (itmp < 1 ) {
//FIXME add mem cleanup code
FIXME("gfire_read_attrib returned < 1! sids");
		return NULL;
	}	
	index += itmp + 1;
	itmp = gfire_read_attrib(&msgs, gfire->buff_in + index, packet_len - index, "msg", TRUE, FALSE, 0, 0, 0);
	if (itmp < 1 ) {
//FIXME add mem cleanup code
FIXME("gfire_read_attrib returned < 1! msgs");
		return NULL;
	}	

	msgs = g_list_first(msgs); sids = g_list_first(sids);
	m = msgs; s = sids;
	
	while ( NULL != s ){
		btmp = gfire_find_buddy_in_list(gfire->buddies, s->data, GFFB_SIDBIN);
		if (NULL == btmp) {
			purple_debug(PURPLE_DEBUG_MISC, "gfire", "WARN: pkt 154: (away status) could not find sid in buddy list.\n");
		} else {
			gf_buddy = (gfire_buddy *)btmp->data;
			if (NULL != m->data) {
				/* got an away message */
				gf_buddy->away = TRUE;
				gf_buddy->away_msg = m->data;
			} else {
				/* no message, user is back */
				gf_buddy->away = FALSE;
				if (NULL != gf_buddy->away_msg) g_free(gf_buddy->away_msg);
				gf_buddy->away_msg = NULL;
			}
			ret = g_list_append(ret, (gpointer *)gf_buddy);

			purple_debug(PURPLE_DEBUG_MISC, "gfire","(away): %s, is away/back with msg %s\n",
						NN(gf_buddy->name), NN(gf_buddy->away_msg));
		}
		g_free(s->data);
		s->data = NULL;
		s = g_list_next(s); m = g_list_next(m);
	}
	g_list_free(msgs);
	g_list_free(sids);
	return ret;
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:59,代码来源:gf_packet.c

示例7: gfire_chat_proto_user_join

void gfire_chat_proto_user_join(gfire_data *p_gfire, guint16 p_packet_len)
{
	if(!p_gfire)
		return;

	guint32 offset = XFIRE_HEADER_LEN;

	guint8 *chat_id = NULL;
	gfire_chat *chat = NULL;
	guint32 userid = 0;
	gchar *name = NULL;
	gchar *nick = NULL;
	guint32 perm = 0;
	gfire_buddy *gf_buddy = NULL;

	offset = gfire_proto_read_attr_chatid_bs(p_gfire->buff_in, &chat_id, 0x04, offset);
	if(offset == -1 || !chat_id)
		return;

	chat = gfire_find_chat(p_gfire, chat_id, GFFC_CID);
	if(!chat)
	{
		g_free(chat_id);
		purple_debug_error("gfire", "gfire_chat_proto_user_leave: Unknown chat id!\n");
		return;
	}

	g_free(chat_id);

	offset = gfire_proto_read_attr_int32_bs(p_gfire->buff_in, &userid, 0x01, offset);
	if(offset == -1)
		return;

	offset = gfire_proto_read_attr_string_bs(p_gfire->buff_in, &name, 0x02, offset);
	if(offset == -1 || !name)
	{
		return;
	}

	offset = gfire_proto_read_attr_string_bs(p_gfire->buff_in, &nick, 0x0D, offset);
	if(offset == -1 || !nick)
	{
		g_free(name);
		return;
	}

	offset = gfire_proto_read_attr_int32_bs(p_gfire->buff_in, &perm, 0x12, offset);
	if(offset == -1)
		return;

	gf_buddy = gfire_buddy_create(userid, name, nick, GFBT_GROUPCHAT);
	gfire_chat_add_user(chat, gf_buddy, perm, TRUE);

	purple_debug(PURPLE_DEBUG_MISC, "gfire", "groupchat join, userid: %u, username: %s, alias: %s\n",
				 userid, NN(name), NN(nick));

	g_free(name);
	g_free(nick);
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:59,代码来源:gf_chat_proto.c

示例8: ContentDir_Search

/*****************************************************************************
 * ContentDir_Search
 *****************************************************************************/
const ContentDir_BrowseResult*
ContentDir_Search (ContentDir* cds, void* result_context, 
		   const char* objectId, const char* criteria)
{
	Log_Printf (LOG_DEBUG, "ContentDir_Search objectId='%s' criteria='%s'",
		    NN(objectId), NN(criteria));
	return BrowseOrSearchWithCache (cds, result_context, 
					objectId, criteria);
}
开发者ID:Boxee,项目名称:djmount,代码行数:12,代码来源:content_dir.c

示例9: icontainer_real_parent_add

static void
icontainer_real_parent_add( iContainer *child )
{
#ifdef DEBUG
	printf( "icontainer_real_parent_add: child %s \"%s\"; " 
		"parent %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( child ), 
		NN( IOBJECT( child )->name ),
		G_OBJECT_TYPE_NAME( child->parent ), 
		NN( IOBJECT( child->parent )->name ) );
#endif /*DEBUG*/
}
开发者ID:jcupitt,项目名称:nip2,代码行数:12,代码来源:icontainer.c

示例10: icontainer_real_parent_remove

static void
icontainer_real_parent_remove( iContainer *child )
{
#ifdef DEBUG
{
	iContainer *parent = child->parent;

	printf( "icontainer_real_parent_remove: child %s \"%s\"; "
		"parent %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( child ), NN( IOBJECT( child )->name ),
		G_OBJECT_TYPE_NAME( parent ), NN( IOBJECT( parent )->name ) );
}
#endif /*DEBUG*/
}
开发者ID:jcupitt,项目名称:nip2,代码行数:14,代码来源:icontainer.c

示例11: ContentDir_GetSearchCapabilities

/*****************************************************************************
 * ContentDir_GetSearchCapabilities
 *****************************************************************************/
const char*
ContentDir_GetSearchCapabilities (ContentDir* self, void* unused)
{
	if (self == NULL)
		return NULL; // ---------->
	
	// Send Action if result not already cached
	if (self->search_caps == NULL) {

		IXML_Document* doc = NULL;
		int rc = Service_SendActionVa
			(OBJECT_SUPER_CAST(self), &doc,
			 "GetSearchCapabilities",
			 NULL, NULL);
		if (rc == UPNP_E_SUCCESS && doc != NULL) {
			self->search_caps = talloc_strdup 
				(self, XMLUtil_FindFirstElementValue
				 (XML_D2N (doc), "SearchCaps", true, true));
			
			Log_Printf (LOG_DEBUG, 
				    "ContentDir_GetSearchCapabilities = '%s'",
				    NN(self->search_caps));
		}
		ixmlDocument_free (doc);
	}
	
	return self->search_caps;
}
开发者ID:Boxee,项目名称:djmount,代码行数:31,代码来源:content_dir.c

示例12: workspace_set_needs_layout

void
workspace_set_needs_layout( Workspace *ws, gboolean needs_layout )
{
#ifdef DEBUG
	printf( "workspace_set_needs_layout: %p %s %d\n", 
		ws, NN( IOBJECT( ws )->name ), needs_layout );
#endif /*DEBUG*/

	if( !ws->needs_layout && 
		needs_layout &&
		!ws->in_dispose ) { 
		g_assert( !g_slist_find( workspace_needs_layout, ws ) ); 

		ws->needs_layout = TRUE;
		workspace_needs_layout = g_slist_prepend( 
			workspace_needs_layout, ws ); 
	}

	if( ws->needs_layout && !needs_layout ) { 
		g_assert( g_slist_find( workspace_needs_layout, ws ) ); 

		ws->needs_layout = FALSE;
		workspace_needs_layout = g_slist_remove( 
			workspace_needs_layout, ws ); 
	}
}
开发者ID:imclab,项目名称:nip2,代码行数:26,代码来源:workspace.c

示例13: icontainer_current

void 
icontainer_current( iContainer *parent, iContainer *child )
{
	g_assert( parent );
	g_assert( !child || ICONTAINER_IS_CHILD( parent, child ) );

	if( parent->current == child )
		return; 

#ifdef DEBUG
	printf( "icontainer_current: (child %p)\n", child );
	printf( "\tchild: %s \"%s\"\n",
		G_OBJECT_TYPE_NAME( child ), 
		NN( IOBJECT( child )->name ) );
#endif /*DEBUG*/

#ifdef DEBUG_SANITY
	icontainer_sanity( parent );
	if( child )
		icontainer_sanity( child );
#endif /*DEBUG_SANITY*/

	g_signal_emit( G_OBJECT( parent ), 
		icontainer_signals[SIG_CURRENT], 0, child );

#ifdef DEBUG_SANITY
	icontainer_sanity( parent );
	if( child )
		icontainer_sanity( child );
#endif /*DEBUG_SANITY*/
}
开发者ID:jcupitt,项目名称:nip2,代码行数:31,代码来源:icontainer.c

示例14: Pipeline1

//TSP -> NN -> Generations( g, ForkJoin ( n, SA -> 2-OPT ) ) -> TSP'
void Pipeline1(tsp_class& tsp_instance, unsigned int number_of_tasks, unsigned int number_of_generations)
{
	#pragma region "PipelineConfiguration"
	auto a = Args<General_args_type>(make_General_args(number_of_generations, number_of_tasks));
	auto sa = Args<SA_args_type>(make_SA_args(1000.0, 0.00001, 0.999, 400));
	auto aco = Args<ACO_args_type>();
	auto ga = Args<GA_args_type>();

	const char* pipeline_description = "TSP -> NN -> Generations( g, ForkJoin ( n, SA -> 2-OPT ) ) -> TSP'";
	display_args(pipeline_description, a, sa, aco, ga);
	
	auto g = a[0].number_of_iterations_or_generations;
	auto n = a[0].number_of_tasks_in_parallel;
	auto _TSP = TSP(just(tsp_instance));
	auto _DisplayInput = Display("TSP INPUT", DisplayFlags::All);
	auto _NN = Measure(NN(), Display("NEAREST NEIGHBOUR", DisplayFlags::EmitMathematicaGraphPlot));	
	auto _SA_2OPT = Chain(SA(sa[0].initial_temperature, sa[0].stopping_criteria_temperature, 
							 sa[0].decreasing_factor, sa[0].monte_carlo_steps), _2OPT());
	auto _ForkJoin = [](unsigned int n, TSP::transformer_type map_fun){ return Measure(ForkJoin(n, map_fun)); };
	auto _DisplayOutput = Display("TSP OUTPUT", DisplayFlags::EmitMathematicaGraphPlot); 
	#pragma endregion

	//TSP -> NN -> Generations( g, ForkJoin ( n, SA -> 2-OPT ) ) -> TSP'
	auto result = _TSP
					.map(_DisplayInput)
					.map(_NN)
					.map(Generations(g, _ForkJoin(n, _SA_2OPT)))
					.map(_DisplayOutput);
}
开发者ID:fabiogaluppo,项目名称:samples,代码行数:30,代码来源:program.cpp

示例15: Pipeline2

//TSP -> NN -> Generations( g, ForkJoin ( n, GA -> 2-OPT ) ) -> TSP'
void Pipeline2(tsp_class& tsp_instance, unsigned int number_of_tasks, 
			                            unsigned int number_of_generations)
{
	#pragma region "PipelineConfiguration"
	auto a = Args<General_args_type>(make_General_args(number_of_generations, number_of_tasks));
	auto sa = Args<SA_args_type>();
	auto aco = Args<ACO_args_type>();
	auto ga = Args<GA_args_type>(make_GA_args(1000, 10, 5, 50000, 10, 0.9));

	const char* pipeline_description = "TSP -> NN -> Generations( g, ForkJoin ( n, GA -> 2-OPT ) ) -> TSP'";
	display_args(pipeline_description, a, sa, aco, ga);
	
	auto g = a[0].number_of_iterations_or_generations;
	auto n = a[0].number_of_tasks_in_parallel;
	auto _TSP = TSP(just(tsp_instance));
	auto _DisplayInput = Display("TSP INPUT", DisplayFlags::All);
	auto _NN = Measure(NN(), Display("NEAREST NEIGHBOUR", DisplayFlags::EmitMathematicaGraphPlot));	
	auto _GA_2OPT = Chain(GA(ga[0].population_size, ga[0].mutation_percentage, ga[0].group_size, 
							 ga[0].number_of_generations, ga[0].nearby_cities, ga[0].nearby_cities_percentage), _2OPT());
	auto _ForkJoin = [](unsigned int n, TSP::transformer_type map_fun){ return Measure(ForkJoin(n, map_fun)); };
	auto _DisplayOutput = Display("TSP OUTPUT", DisplayFlags::EmitMathematicaGraphPlot); 
	#pragma endregion

	//TSP -> NN -> Generations( g, ForkJoin ( n, GA -> 2-OPT ) ) -> TSP'
	auto result = _TSP
					.map(_DisplayInput)
					.map(_NN)
					.map(Generations(g, _ForkJoin(n, _GA_2OPT)))
					.map(_DisplayOutput);
}
开发者ID:fabiogaluppo,项目名称:samples,代码行数:31,代码来源:program.cpp


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