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


C++ NUMELEMS函数代码示例

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


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

示例1: StringToSerialType

BasicSerializedDataType StringToSerialType(const char *type)
{
	if (!strcmp(type, "string") || !strcmp(type, "std::string"))
		return SerialString;
	assert(NumSerialTypes-2 == NUMELEMS(data));
	for(size_t i = 0; i < NUMELEMS(data); ++i)
		if (!strcmp(type, data[i]))
			return (BasicSerializedDataType)i;

	return SerialInvalid;
}
开发者ID:ElishaMcNutt,项目名称:Clockwork,代码行数:11,代码来源:MessageListParser.cpp

示例2: assert

const char *SerialTypeToReadableString(BasicSerializedDataType type)
{
	assert(NumSerialTypes-2 == NUMELEMS(data));
	assert(type >= SerialInvalid);
	assert(type < NumSerialTypes); 
	return data[type];
}
开发者ID:ElishaMcNutt,项目名称:Clockwork,代码行数:7,代码来源:MessageListParser.cpp

示例3: SerialTypeSize

size_t SerialTypeSize(BasicSerializedDataType type)
{
	assert(NumSerialTypes-2 == NUMELEMS(data));
	assert(type >= SerialInvalid);
	assert(type < NumSerialTypes); 
	return typeSizes[type];	
}
开发者ID:ElishaMcNutt,项目名称:Clockwork,代码行数:7,代码来源:MessageListParser.cpp

示例4: ixHssAccCodeletChanThreadMain

PRIVATE
IX_STATUS
ixHssAccCodeletChanThreadMain (
    void* arg,
    void** ptrRetObj)
{
    ClientInfo *pClientInfo = (ClientInfo *)arg;
    Message *pMessage;

    while (1)
    {
        (void) ixOsalSemaphoreWait (
            &pClientInfo->messageSem, IX_OSAL_WAIT_FOREVER);

        pMessage = &pClientInfo->messageQ[pClientInfo->qTail++];
        pClientInfo->qTail %= NUMELEMS(pClientInfo->messageQ);

        switch (pMessage->type)
        {
        case RxCallback:
            ixHssAccCodeletChanRxCallbackProcess (
                pClientInfo->hssPortId,
                pMessage->params.rxOffset,
                pMessage->params.txOffset,
                pMessage->params.numHssErrs);
            break;
        }
    } /* while (1) */

    return IX_SUCCESS;
}
开发者ID:janfj,项目名称:dd-wrt,代码行数:31,代码来源:IxHssAccCodeletChan.c

示例5: ixAtmUtilsMbufPoolFreeGet

void
ixAtmUtilsMbufPoolFreeGet (UINT32 bufSize, UINT32 *avail)
{
    IX_OSAL_MBUF_POOL *poolPtr = NULL;
    unsigned i,numPools;

    numPools = NUMELEMS (poolInfo);

    for (i = 0; i < numPools; i++)
    {
        if (poolInfo[i].bufSize >= bufSize)
	{
            poolPtr = poolInfo[i].poolPtr;
            break;
	}
    }

    if (poolPtr == NULL)
    {
        ixOsalLog (IX_OSAL_LOG_LVL_ERROR,IX_OSAL_LOG_DEV_STDERR,
	    "ixAtmUtilsMbufPoolFreeGet - Invalid bufSize specified\n", 0, 0, 0, 0, 0, 0);
	*avail = 0;
        return;
    }

    *avail = poolPtr->freeBufsInPool;
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:27,代码来源:IxAtmUtilsBufMan.c

示例6: load_alldevs

void load_alldevs(void){
  char *devs[] = DEVICES_USED;
  int num = NUMELEMS(devs);
  int i;
  for(i=0; i< num;i++)
    load_dev(devs[i]);
  return;
}
开发者ID:amarnathmhn,项目名称:ngspice,代码行数:8,代码来源:dev.c

示例7:

    const char *VariableTypeToStr(NetVariableType type)
    {
        const char *data[] = { "Invalid", "U8", "U16", "U32", "U64", "S8", "S16", "S32", "S64", "F32", "F64", "LLVector3", "LLVector3d",
            "LLVector4", "LLQuaternion", "UUID", "BOOL", "IPADDR", "IPPORT", "Fixed", "Variable", "BufferByte", "Buffer2Bytes", "Buffer4Bytes" };
        if (type < 0 || type >= NUMELEMS(data))
            return data[0];

        return data[type];
    }
开发者ID:A-K,项目名称:naali,代码行数:9,代码来源:NetMessageManager.cpp

示例8: NUMELEMS

    void NetMessageManager::DebugSendHardcodedTestPacket()
    {
        const uint8_t data[] =
        { 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x00, 0x03, 0x37, 0x2d, 0x5e, 0x0d, 0xde, 0xc9, 0x50, 
          0xb7, 0x40, 0x2d, 0xa2, 0x23, 0xc1, 0xae, 0xe0, 0x7e, 0x35, 0xe6, 0x8e, 0x5b, 0x78, 0x42, 0xac, 0x6d, 
          0x11, 0x67, 0x47, 0xde, 0x91, 0xf3, 0x58, 0xa9, 0x65, 0x49, 0xb0, 0xf0 };

        connection->SendBytes(data, NUMELEMS(data));
    }
开发者ID:A-K,项目名称:naali,代码行数:9,代码来源:NetMessageManager.cpp

示例9: MultiByteToWideChar

void *AssetCache::OpenFileHandle(const QString &absolutePath)
{
    QString nativePath = QDir::toNativeSeparators(absolutePath);
    QByteArray fileBA = nativePath.toLocal8Bit();
    if (fileBA.size() < MAX_PATH)
    {
        WCHAR szFilePath[MAX_PATH];
        MultiByteToWideChar(CP_ACP, 0, fileBA.data(), -1, szFilePath, NUMELEMS(szFilePath));
        return CreateFile(szFilePath, GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    }
    else
    {
        // Prefixing file path with \\?\ is windows magic, see more from
        // http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
        // This allows use to open >MAX_PATH length file paths which do happen in asset cache if the 
        // source url is long! Assume 260*3 will be enough as it still very rarely goes over 260.
        fileBA = "\\\\?\\" + fileBA;
        WCHAR szFilePath[MAX_PATH*3];
        MultiByteToWideChar(CP_ACP, 0, fileBA.data(), -1, szFilePath, NUMELEMS(szFilePath));
        return CreateFileW(szFilePath, GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    }
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:22,代码来源:AssetCache.cpp

示例10: IsAssimpFileType

bool OgreMeshAsset::IsAssimpFileType() const
{
    const char * const openAssImpFileTypes[] = { ".3d", ".b3d", ".blend", ".dae", ".bvh", ".3ds", ".ase", ".obj", ".ply", ".dxf",
        ".nff", ".smd", ".vta", ".mdl", ".md2", ".md3", ".mdc", ".md5mesh", ".x", ".q3o", ".q3s", ".raw", ".ac",
        ".stl", ".irrmesh", ".irr", ".off", ".ter", ".mdl", ".hmp", ".ms3d", ".lwo", ".lws", ".lxo", ".csm",
        ".ply", ".cob", ".scn" };

    for(size_t i = 0; i < NUMELEMS(openAssImpFileTypes); ++i)
        if (this->Name().endsWith(openAssImpFileTypes[i], Qt::CaseInsensitive))
            return true;

    return false;
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:13,代码来源:OgreMeshAsset.cpp

示例11: msg_spy_find_msg

static CWPSTRUCT* msg_spy_find_msg(UINT message) {
    UINT i;

    msg_spy_pump_msg_queue();

    if (msg_spy.i_msg >= NUMELEMS(msg_spy.msgs))
        fprintf(stdout, "%s:%d: msg_spy: message buffer overflow!\n",
                __FILE__, __LINE__);

    for (i = 0; i < msg_spy.i_msg; i++)
        if (msg_spy.msgs[i].message == message)
            return &msg_spy.msgs[i];

    return NULL;
}
开发者ID:bilboed,项目名称:wine,代码行数:15,代码来源:imm32.c

示例12: rtems_monitor_object_lookup

const rtems_monitor_object_info_t *
rtems_monitor_object_lookup(
    rtems_monitor_object_type_t type
)
{
    const rtems_monitor_object_info_t *p;
    for (p = &rtems_monitor_object_info[0];
         p < &rtems_monitor_object_info[NUMELEMS(rtems_monitor_object_info)];
         p++)
    {
        if (p->type == type)
            return p;
    }
    return 0;
}
开发者ID:atixing,项目名称:rtems,代码行数:15,代码来源:mon-object.c

示例13: call_wnd_proc_filter

static LRESULT CALLBACK call_wnd_proc_filter(int nCode, WPARAM wParam,
                                             LPARAM lParam)
{
    if (HC_ACTION == nCode) {
        CWPSTRUCT *cwp = (CWPSTRUCT*)lParam;

        if ((cwp->hwnd == msg_spy.hwnd) &&
            (msg_spy.i_msg < NUMELEMS(msg_spy.msgs)))
        {
            memcpy(&msg_spy.msgs[msg_spy.i_msg], cwp, sizeof(msg_spy.msgs[0]));
            msg_spy.i_msg++;
        }
    }

    return CallNextHookEx(msg_spy.call_wnd_proc_hook, nCode, wParam, lParam);
}
开发者ID:bilboed,项目名称:wine,代码行数:16,代码来源:imm32.c

示例14: afdict_find

/**
 * Find the affix table entry for given connector name.
 * If the connector name is not in the table, return NULL.
 */
Afdict_class * afdict_find(Dictionary afdict, const char * con, bool notify_err)
{
	const char ** ac;

	for (ac = afdict_classname;
	     ac < &afdict_classname[NUMELEMS(afdict_classname)]; ac++)
	{
		if (0 == strcmp(*ac, con))
			return &afdict->afdict_class[ac - afdict_classname];
	}
	if (notify_err) {
		prt_error("Warning: Unknown class name %s found near line %d of %s.\n"
                "\tThis class name will be ignored.",
                con, afdict->line_number, afdict->name);
	}
	return NULL;
}
开发者ID:agayardo,项目名称:link-grammar,代码行数:21,代码来源:dictionary.c

示例15: get_msg_filter

static LRESULT CALLBACK get_msg_filter(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (HC_ACTION == nCode) {
        MSG *msg = (MSG*)lParam;

        if ((msg->hwnd == msg_spy.hwnd) &&
            (msg_spy.i_msg < NUMELEMS(msg_spy.msgs)))
        {
            msg_spy.msgs[msg_spy.i_msg].hwnd    = msg->hwnd;
            msg_spy.msgs[msg_spy.i_msg].message = msg->message;
            msg_spy.msgs[msg_spy.i_msg].wParam  = msg->wParam;
            msg_spy.msgs[msg_spy.i_msg].lParam  = msg->lParam;
            msg_spy.i_msg++;
        }
    }

    return CallNextHookEx(msg_spy.get_msg_hook, nCode, wParam, lParam);
}
开发者ID:bilboed,项目名称:wine,代码行数:18,代码来源:imm32.c


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