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


C++ Worker::GetIndex方法代码示例

本文整理汇总了C++中Worker::GetIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Worker::GetIndex方法的具体用法?C++ Worker::GetIndex怎么用?C++ Worker::GetIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Worker的用法示例。


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

示例1: SelectWorkerByName

//
// Find a worker by its name (as stored in result file) and select it
// as though it had been dragged.
// 
void CPageDisplay::SelectWorkerByName( int button, const char *wkr_name, const int wkr_id )
{
	Manager *mgr;
	Worker *wkr;

	if ( !wkr_name )
	{
		ErrorMessage( "Invalid string in CPageDisplay::SelectWorkerByName()" );
		return;
	}

	// Get a pointer to the button's currently assigned manager
	mgr = barcharts[button].manager;
	if ( mgr )
	{
		// The specified button already has a manager (probably was just assigned by 
		// the previous line in the config file, but even if not we'll use it anyway).

		if ( strlen( wkr_name ) )
		{
			// The worker name is non-empty; get a pointer to the
			// first worker with the specified name within the current manager
			wkr = mgr->GetWorkerByName( wkr_name, wkr_id );
			
			if ( wkr )
			{
				// A worker with the specified name was found; use it
				SetResultSource( mgr->GetIndex(), wkr->GetIndex(), button );
			}
			else
			{
				// No worker with the specified name was found
				if ( mgr->WorkerCount() == 1 )
				{
					// There is only one worker; use it (ignoring its name)
					SetResultSource( mgr->GetIndex(), 0, button );
				}
				else
				{
					// More than one worker; default to all workers
					SetResultSource( mgr->GetIndex(), IOERROR, button );
				}
			}
		}
		else
		{
			// The worker name is an empty string; use all workers
			SetResultSource( mgr->GetIndex(), IOERROR, button );
		}
	}
	// Else: the specified button does not have a manager, ignore the specified worker name
}
开发者ID:BackupTheBerlios,项目名称:iometer-svn,代码行数:56,代码来源:PageDisplay.cpp


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