• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ENUM_TO_STRING函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: JSONEncoder_CharPtr_ToString

JSON_ENCODER_TOSTRING_RESULT JSONEncoder_CharPtr_ToString(STRING_HANDLE destination, const void* value)
{
    JSON_ENCODER_TOSTRING_RESULT result;

    /*Coes_SRS_JSON_ENCODER_99_047:[ JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_INVALID_ARG if destination or value parameters passed to it are NULL.]*/
    if ((destination == NULL) ||
        (value == NULL))
    {
        result = JSON_ENCODER_TOSTRING_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result));
    }
    /*Codes_SRS_JSON_ENCODER_99_048:[ JSONEncoder_CharPtr_ToString shall use strcpy_s to copy from value to destination.]*/
    else if (STRING_concat(destination, (const char*)value) != 0)
    {
        /*Codes_SRS_JSON_ENCODER_99_049:[ If strcpy_s fails then JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_ERROR.]*/
        result = JSON_ENCODER_TOSTRING_ERROR;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result));
    }
    else
    {
        /*Codes_SRS_JSON_ENCODER_99_050:[ If strcpy_s doesn't fail, then JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_OK]*/
        result = JSON_ENCODER_TOSTRING_OK;
    }

    return result;
}
开发者ID:Ahmed-Salama,项目名称:Project_JAR,代码行数:26,代码来源:jsonencoder.c


示例2: MultiTree_GetValue

MULTITREE_RESULT MultiTree_GetValue(MULTITREE_HANDLE treeHandle, const void** destination)
{
    MULTITREE_RESULT result;
    /*Codes_SRS_MULTITREE_99_042:[If treeHandle is NULL, the function shall return MULTITREE_INVALID_ARG.]*/
    if (treeHandle == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    /*Codes_SRS_MULTITREE_99_043:[ If destination is NULL, the function shall return MULTITREE_INVALID_ARG.]*/
    else if (destination == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    else
    {
        MULTITREE_HANDLE_DATA * node = (MULTITREE_HANDLE_DATA*)treeHandle;
        /*Codes_SRS_MULTITREE_99_044:[ If there is no value in the node then MULTITREE_EMPTY_VALUE shall be returned.]*/
        if (node->value == NULL)
        {
            result = MULTITREE_EMPTY_VALUE;
            LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
        }
        else
        {
            /*Codes_SRS_MULTITREE_99_041:[This function updates the *destination parameter to the internally stored value.]*/
            *destination = node->value;
            result = MULTITREE_OK;
        }
    }
    return result;
}
开发者ID:mohesk,项目名称:azure-iot-sdks,代码行数:33,代码来源:multitree.c


示例3: Lock

LOCK_RESULT Lock(LOCK_HANDLE handle)
{
    LOCK_RESULT result;
    if (handle == NULL)
    {
        /*SRS_LOCK_99_007:[ This API on NULL handle passed returns LOCK_ERROR]*/
        result = LOCK_ERROR;
        LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
    }
    else
    {
        if (mtx_lock((mtx_t*)handle) == thrd_success)
        {
            /*SRS_LOCK_99_005:[ This API on success should return LOCK_OK]*/
            result = LOCK_OK;
        }
        else
        {
            /*SRS_LOCK_99_006:[ This API on error should return LOCK_ERROR]*/
            result = LOCK_ERROR;
            LogError("(result = %s)", ENUM_TO_STRING(LOCK_RESULT, result));
        }
    }
    return result;
}
开发者ID:aog2000a,项目名称:azure-c-shared-utility,代码行数:25,代码来源:lock_c11.c


示例4: ThreadAPI_Join

THREADAPI_RESULT ThreadAPI_Join(THREAD_HANDLE threadHandle, int* res)
{
    THREADAPI_RESULT result;

    THREAD_INSTANCE* threadInstance = (THREAD_INSTANCE*)threadHandle;
    if (threadInstance == NULL)
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        void* threadResult;
        if (pthread_join(threadInstance->Pthread_handle, &threadResult) != 0)
        {
            result = THREADAPI_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
        }
        else
        {
            if (res != NULL)
            {
                *res = (int)(intptr_t)threadResult;
            }

            result = THREADAPI_OK;
        }

        free(threadInstance);
    }

    return result;
}
开发者ID:JohnCashmore,项目名称:azure-iot-sdks,代码行数:33,代码来源:threadapi_pthreads.c


示例5: ThreadAPI_Create

THREADAPI_RESULT ThreadAPI_Create(THREAD_HANDLE* threadHandle, THREAD_START_FUNC func, void* arg)
{
    THREADAPI_RESULT result;
    if ((threadHandle == NULL) ||
        (func == NULL))
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        *threadHandle = CreateThread(NULL, 0, func, arg, 0, NULL);
        if(threadHandle == NULL)
        {
            result = THREADAPI_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
        }
        else
        {
            result = THREADAPI_OK;
        }
    }

    return result;
}
开发者ID:ashokkhurana,项目名称:azure-c-shared-utility,代码行数:25,代码来源:threadapi_win32.c


示例6: DataPublisher_StartTransaction

TRANSACTION_HANDLE DataPublisher_StartTransaction(DATA_PUBLISHER_HANDLE dataPublisherHandle)
{
    TRANSACTION* transaction;

    /* Codes_SRS_DATA_PUBLISHER_99_038:[ If DataPublisher_StartTransaction is called with a NULL argument it shall return NULL.] */
    if (dataPublisherHandle == NULL)
    {
        transaction = NULL;
        LogError("(Error code: %s)\r\n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_INVALID_ARG));
    }
    else
    {
        /* Codes_SRS_DATA_PUBLISHER_99_007:[ A call to DataPublisher_StartTransaction shall start a new transaction.] */
        transaction = (TRANSACTION*)malloc(sizeof(TRANSACTION));
        if (transaction == NULL)
        {
            LogError("Allocating transaction failed (Error code: %s)\r\n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_ERROR));
        }
        else
        {
            transaction->ValueCount = 0;
            transaction->Values = NULL;
            transaction->DataPublisherInstance = (DATA_PUBLISHER_INSTANCE*)dataPublisherHandle;
        }
    }

    /* Codes_SRS_DATA_PUBLISHER_99_008:[ DataPublisher_StartTransaction shall return a non-NULL handle upon success.] */
    /* Codes_SRS_DATA_PUBLISHER_99_009:[ DataPublisher_StartTransaction shall return NULL upon failure.] */
    return transaction;
}
开发者ID:Ahmed-Salama,项目名称:Project_JAR,代码行数:30,代码来源:datapublisher.c


示例7: serializer_init

SERIALIZER_RESULT serializer_init(const char* overrideSchemaNamespace)
{
    SERIALIZER_RESULT result;

    /* Codes_SRS_SCHEMALIB_99_074:[serializer_init when already initialized shall return SERIALIZER_ALREADY_INIT.] */
    if (g_AgentState != AGENT_NOT_INITIALIZED)
    {
        result = SERIALIZER_ALREADY_INIT;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(SERIALIZER_RESULT, result));
    }
    else
    {
        /* Codes_SRS_SCHEMALIB_99_006:[ Initialize CodeFirst by a call to CodeFirst_Init.] */
        /* Codes_SRS_SCHEMALIB_99_076:[serializer_init shall pass the value of overrideSchemaNamespace argument to CodeFirst_Init.] */
        if (CodeFirst_Init(overrideSchemaNamespace) != CODEFIRST_OK)
        {
            /* Codes_SRS_SCHEMALIB_99_007:[ On error SERIALIZER_CODEFIRST_INIT_FAILED shall be returned.] */
            result = SERIALIZER_CODEFIRST_INIT_FAILED;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(SERIALIZER_RESULT, result));
        }
        else
        {
            /* Codes_SRS_SCHEMALIB_99_075:[When an serializer_init call fails for any reason the previous initialization state shall be preserved. The initialized state shall only be changed on a succesfull Init.] */
            g_AgentState = AGENT_INITIALIZED;

            /* Codes_SRS_SCHEMALIB_99_073:[On success serializer_init shall return SERIALIZER_OK.] */
            result = SERIALIZER_OK;
        }
    }

    return result;
}
开发者ID:MaxKhlupnov,项目名称:azure-iot-sdks,代码行数:32,代码来源:schemalib.c


示例8: HTTPHeaders_GetHeader

/*produces a string in *destination that is equal to name: value*/
HTTP_HEADERS_RESULT HTTPHeaders_GetHeader(HTTP_HEADERS_HANDLE handle, size_t index, char** destination)
{
    HTTP_HEADERS_RESULT result = HTTP_HEADERS_OK;

    /*Codes_SRS_HTTP_HEADERS_99_028:[ The function shall return NULL if the handle is invalid.]*/
    /*Codes_SRS_HTTP_HEADERS_99_032:[ The function shall return HTTP_HEADERS_INVALID_ARG if the destination  is NULL]*/
    if (
        (handle == NULL) ||
        (destination == NULL)
        )
    {
        result = HTTP_HEADERS_INVALID_ARG;
        LogError("invalid arg (NULL), result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
    }
    /*Codes_SRS_HTTP_HEADERS_99_029:[ The function shall return HTTP_HEADERS_INVALID_ARG if index is not valid (for example, out of range) for the currently stored headers.]*/
    else
    {
        HTTP_HEADERS_HANDLE_DATA* handleData = (HTTP_HEADERS_HANDLE_DATA*)handle;
        const char*const* keys;
        const char*const* values;
        size_t headerCount;
        if (Map_GetInternals(handleData->headers, &keys, &values, &headerCount) != MAP_OK)
        {
            /*Codes_SRS_HTTP_HEADERS_99_034:[ The function shall return HTTP_HEADERS_ERROR when an internal error occurs]*/
            result = HTTP_HEADERS_ERROR;
            LogError("Map_GetInternals failed, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
        }
        else
        {
            /*Codes_SRS_HTTP_HEADERS_99_029:[ The function shall return HTTP_HEADERS_INVALID_ARG if index is not valid (for example, out of range) for the currently stored headers.]*/
            if (index >= headerCount)
            {
                result = HTTP_HEADERS_INVALID_ARG;
                LogError("index out of bounds, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
            }
            else
            {
                *destination = (char*)malloc(strlen(keys[index]) + COLON_AND_SPACE_LENGTH + strlen(values[index]) + 1);
                if (*destination == NULL)
                {
                    /*Codes_SRS_HTTP_HEADERS_99_034:[ The function shall return HTTP_HEADERS_ERROR when an internal error occurs]*/
                    result = HTTP_HEADERS_ERROR;
                    LogError("unable to malloc, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
                }
                else
                {
                    /*Codes_SRS_HTTP_HEADERS_99_016:[ The function shall store the name:value pair in such a way that when later retrieved by a call to GetHeader it will return a string that shall strcmp equal to the name+": "+value.]*/
                    /*Codes_SRS_HTTP_HEADERS_99_027:[ Calling this API shall produce the string value+": "+pair) for the index header in the *destination parameter.]*/
                    strcpy(*destination, keys[index]);
                    strcat(*destination, COLON_AND_SPACE);
                    strcat(*destination, values[index]);
                    /*Codes_SRS_HTTP_HEADERS_99_035:[ The function shall return HTTP_HEADERS_OK when the function executed without error.]*/
                    result = HTTP_HEADERS_OK;
                }
            }
        }
    }

    return result;
}
开发者ID:aog2000a,项目名称:azure-c-shared-utility,代码行数:61,代码来源:httpheaders.c


示例9: Unlock

LOCK_RESULT Unlock(LOCK_HANDLE handle)
{
	LOCK_RESULT result;
	if (handle == NULL)
	{
		/*SRS_LOCK_99_011:[ This API on NULL handle passed returns LOCK_ERROR]*/
		result = LOCK_ERROR;
		LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
	}
	else
	{
		if (pthread_mutex_unlock((pthread_mutex_t*)handle) == 0)
		{
			/*SRS_LOCK_99_009:[ This API on success should return LOCK_OK]*/
			result = LOCK_OK;
		}
		else
		{
			/*SRS_LOCK_99_010:[ This API on error should return LOCK_ERROR]*/
			result = LOCK_ERROR;
			LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
		}
	}
	return result;
}
开发者ID:rabbitom,项目名称:azure-c-shared-utility,代码行数:25,代码来源:lock_pthreads.c


示例10: HTTPHeaders_GetHeaderCount

HTTP_HEADERS_RESULT HTTPHeaders_GetHeaderCount(HTTP_HEADERS_HANDLE handle, size_t* headerCount)
{
    HTTP_HEADERS_RESULT result;
    /*Codes_SRS_HTTP_HEADERS_99_024:[ The function shall return HTTP_HEADERS_INVALID_ARG when an invalid handle is passed.]*/
    /*Codes_SRS_HTTP_HEADERS_99_025:[ The function shall return HTTP_HEADERS_INVALID_ARG when headersCount is NULL.]*/
    if ((handle == NULL) ||
        (headerCount == NULL))
    {
        result = HTTP_HEADERS_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
    }
    else
    {
        HTTP_HEADERS_HANDLE_DATA *handleData = (HTTP_HEADERS_HANDLE_DATA *)handle;
        const char*const* keys;
        const char*const* values;
        /*Codes_SRS_HTTP_HEADERS_99_023:[ Calling this API shall provide the number of stored headers.]*/
        if (Map_GetInternals(handleData->headers, &keys, &values, headerCount) != MAP_OK)
        {
            /*Codes_SRS_HTTP_HEADERS_99_037:[ The function shall return HTTP_HEADERS_ERROR when an internal error occurs.]*/
            result = HTTP_HEADERS_ERROR;
            LogError("Map_GetInternals failed, result= %s", ENUM_TO_STRING(HTTP_HEADERS_RESULT, result));
        }
        else
        {
            /*Codes_SRS_HTTP_HEADERS_99_026:[ The function shall write in *headersCount the number of currently stored headers and shall return HTTP_HEADERS_OK]*/
            result = HTTP_HEADERS_OK;
        }
    }

    return result;
}
开发者ID:aog2000a,项目名称:azure-c-shared-utility,代码行数:32,代码来源:httpheaders.c


示例11: ThreadAPI_Join

THREADAPI_RESULT ThreadAPI_Join(THREAD_HANDLE threadHandle, int *res)
{
    THREADAPI_RESULT result;
    thrd_t* thrd_t_ptr = (thrd_t*)threadHandle;

    if (threadHandle == NULL)
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        switch (thrd_join(*thrd_t_ptr, res))
        {
        default:
        case thrd_error:
            result = THREADAPI_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
            break;

        case thrd_success:
            result = THREADAPI_OK;
            break;

        case thrd_nomem:
            result = THREADAPI_NO_MEMORY;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
            break;
        }

        free(thrd_t_ptr);
    }

    return result;
}
开发者ID:Deadolus,项目名称:azure-c-shared-utility,代码行数:35,代码来源:threadapi_c11.c


示例12: Lock_Deinit

LOCK_RESULT Lock_Deinit(LOCK_HANDLE handle)
{
	LOCK_RESULT result=LOCK_OK ;
	if (NULL == handle)
	{
		/*SRS_LOCK_99_013:[ This API on NULL handle passed returns LOCK_ERROR]*/
		result = LOCK_ERROR;
		LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
	}
	else
	{
		/*SRS_LOCK_99_012:[ This API frees the memory pointed by handle]*/
		if(pthread_mutex_destroy((pthread_mutex_t*)handle)==0)
		{
			free(handle);
			handle = NULL;
		}
		else
		{
			result = LOCK_ERROR;
			LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
		}
	}
	
	return result;
}
开发者ID:rabbitom,项目名称:azure-c-shared-utility,代码行数:26,代码来源:lock_pthreads.c


示例13: DataMarshaller_Create

DATA_MARSHALLER_HANDLE DataMarshaller_Create(SCHEMA_MODEL_TYPE_HANDLE modelHandle, bool includePropertyPath)
{
    DATA_MARSHALLER_HANDLE result;
    DATA_MARSHALLER_INSTANCE* dataMarshallerInstance;

    /*Codes_SRS_DATA_MARSHALLER_99_019:[ DataMarshaller_Create shall return NULL if any argument is NULL.]*/
    if (
        (modelHandle == NULL) 
        )
    {
        result = NULL;
        LogError("(result = %s)", ENUM_TO_STRING(DATA_MARSHALLER_RESULT, DATA_MARSHALLER_INVALID_ARG));
    }
    else if ((dataMarshallerInstance = (DATA_MARSHALLER_INSTANCE*)malloc(sizeof(DATA_MARSHALLER_INSTANCE))) == NULL)
    {
        /* Codes_SRS_DATA_MARSHALLER_99_048:[On any other errors not explicitly specified, DataMarshaller_Create shall return NULL.] */
        result = NULL;
        LogError("(result = %s)", ENUM_TO_STRING(DATA_MARSHALLER_RESULT, DATA_MARSHALLER_ERROR));
    }
    else
    {
        /*everything ok*/
        dataMarshallerInstance->ModelHandle = modelHandle;
        dataMarshallerInstance->IncludePropertyPath = includePropertyPath;

        /*Codes_SRS_DATA_MARSHALLER_99_018:[ DataMarshaller_Create shall create a new DataMarshaller instance and on success it shall return a non NULL handle.]*/
        result = dataMarshallerInstance;
    }
    return result;
}
开发者ID:BeatriceOltean,项目名称:azure-iot-sdks,代码行数:30,代码来源:datamarshaller.c


示例14: MultiTree_GetChild

MULTITREE_RESULT MultiTree_GetChild(MULTITREE_HANDLE treeHandle, size_t index, MULTITREE_HANDLE *childHandle)
{
    MULTITREE_RESULT result;
    /*Codes_SRS_MULTITREE_99_031:[ If parameter treeHandle is NULL, the function returns MULTITREE_INVALID_ARG.]*/
    if (treeHandle == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    /*Codes_SRS_MULTITREE_99_033:[ If parameter childHandle is NULL, the function shall return MULTITREE_INVALID_ARG.]*/
    else if (childHandle == NULL)
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    else 
    {
        MULTITREE_HANDLE_DATA * node = (MULTITREE_HANDLE_DATA *)treeHandle;
        /*Codes_SRS_MULTITREE_99_032:[If parameter index is out of range, the function shall return MULTITREE_OUT_OF_RANGE_INDEX]*/
        if (node->nChildren <= index)
        {
            result = MULTITREE_INVALID_ARG;
            LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
        }
        else
        {
            /*Codes_SRS_MULTITREE_99_030:[ This function writes in *childHandle parameter the "index"th child of the node pointed to by parameter treeHandle]*/
            /*Codes_SRS_MULTITREE_99_035:[ The function returns MULTITREE_OK when *childHandle contains a handle to the "index"th child of the tree designated by parameter treeHandle.]*/
            *childHandle = node->children[index];
            result = MULTITREE_OK;
        }
    }
    return result;
}
开发者ID:mohesk,项目名称:azure-iot-sdks,代码行数:34,代码来源:multitree.c


示例15: ENUM_TO_STRING

boost::python::dict controller::getILockStatesDefinition()
{
    std::map< VELA_ENUM::ILOCK_STATE,  std::string  > m;
    m[ VELA_ENUM::ILOCK_STATE::ILOCK_BAD   ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_BAD   );
    m[ VELA_ENUM::ILOCK_STATE::ILOCK_GOOD  ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_GOOD  );
    m[ VELA_ENUM::ILOCK_STATE::ILOCK_ERROR ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_ERROR );
    return enumStringMapToPythonDict( m );
}
开发者ID:adb-xkc85723,项目名称:VELA-CLARA-Controllers,代码行数:8,代码来源:controller.cpp


示例16: ENUM_TO_STRING

//______________________________________________________________________________
std::map< VELA_ENUM::ILOCK_NUMBER, std::string  >  shutterInterface::getILockStatesStr( const std::string & name )
{
    std::map< VELA_ENUM::ILOCK_NUMBER, std::string  > r;

    if( entryExists( allShutterData, name ) )
        for( auto it : allShutterData[ name ].iLockStates )
            r[ it.first ] = ENUM_TO_STRING( it.second );
    else
        r[ VELA_ENUM::ILOCK_NUMBER::ILOCK_ERR ] = ENUM_TO_STRING( VELA_ENUM::ILOCK_STATE::ILOCK_ERROR );
    return r;
}
开发者ID:adb-xkc85723,项目名称:VELA-CLARA-Controllers,代码行数:12,代码来源:shutterInterface.cpp


示例17: MultiTree_AddChild

/* Codes_SRS_MULTITREE_99_053:[ MultiTree_AddChild shall add a new node with the name childName to the multi tree node identified by treeHandle] */
MULTITREE_RESULT MultiTree_AddChild(MULTITREE_HANDLE treeHandle, const char* childName, MULTITREE_HANDLE* childHandle)
{
    MULTITREE_RESULT result;
    /* Codes_SRS_MULTITREE_99_055:[ If any argument is NULL, MultiTree_AddChild shall return MULTITREE_INVALID_ARG.] */
    if ((treeHandle == NULL) ||
        (childName == NULL) ||
        (childHandle == NULL))
    {
        result = MULTITREE_INVALID_ARG;
        LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
    }
    else
    {
        MULTITREE_HANDLE_DATA* childNode;

        /* Codes_SRS_MULTITREE_99_060:[ The value associated with the new node shall be NULL.] */
        CREATELEAF_RESULT res = createLeaf((MULTITREE_HANDLE_DATA*)treeHandle, childName, NULL, &childNode);
        switch (res)
        {
            default:
            {
                result = MULTITREE_ERROR;
                LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
                break;
            }
            case CREATELEAF_ALREADY_EXISTS:
            {
                /* Codes_SRS_MULTITREE_99_061:[ If a child node with the same name already exists, MultiTree_AddChild shall return MULTITREE_ALREADY_HAS_A_VALUE.] */
                result = MULTITREE_ALREADY_HAS_A_VALUE;
                LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
                break;
            }
            case CREATELEAF_OK:
            {
                /* Codes_SRS_MULTITREE_99_062:[ The new node handle shall be returned in the childHandle argument.] */
                *childHandle = childNode;

                /* Codes_SRS_MULTITREE_99_054:[ On success, MultiTree_AddChild shall return MULTITREE_OK.] */
                result = MULTITREE_OK;
                break;
            }
            case CREATELEAF_EMPTY_NAME:
            {
                /* Tests_SRS_MULTITREE_99_066:[ If the childName argument is an empty string, MultiTree_AddChild shall return MULTITREE_EMPTY_CHILD_NAME.] */
                result = MULTITREE_EMPTY_CHILD_NAME;
                LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result));
                break;
            }
        }
    }

    return result;
}
开发者ID:mohesk,项目名称:azure-iot-sdks,代码行数:54,代码来源:multitree.c


示例18: ThreadAPI_Create

THREADAPI_RESULT ThreadAPI_Create(THREAD_HANDLE* threadHandle, THREAD_START_FUNC func, void* arg)
{
    THREADAPI_RESULT result;

    if ((threadHandle == NULL) ||
        (func == NULL))
    {
        result = THREADAPI_INVALID_ARG;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
    }
    else
    {
        THREAD_INSTANCE* threadInstance = malloc(sizeof(THREAD_INSTANCE));
        if (threadInstance == NULL)
        {
            result = THREADAPI_NO_MEMORY;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
        }
        else
        {
            threadInstance->ThreadStartFunc = func;
            threadInstance->Arg = arg;
            int createResult = pthread_create(&threadInstance->Pthread_handle, NULL, ThreadWrapper, threadInstance);
            switch (createResult)
            {
            default:
                free(threadInstance);

                result = THREADAPI_ERROR;
                LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
                break;

            case 0:
                *threadHandle = threadInstance;
                result = THREADAPI_OK;
                break;

            case EAGAIN:
                free(threadInstance);

                result = THREADAPI_NO_MEMORY;
                LogError("(result = %s)\r\n", ENUM_TO_STRING(THREADAPI_RESULT, result));
                break;
            }
        }
    }

    return result;
}
开发者ID:JohnCashmore,项目名称:azure-iot-sdks,代码行数:49,代码来源:threadapi_pthreads.c


示例19: IoTHubClient_LL_SetOption

IOTHUB_CLIENT_RESULT IoTHubClient_LL_SetOption(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const char* optionName, const void* value)
{
    
    IOTHUB_CLIENT_RESULT result;
    /*Codes_SRS_IOTHUBCLIENT_LL_02_034: [If iotHubClientHandle is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.]*/
    /*Codes_SRS_IOTHUBCLIENT_LL_02_035: [If optionName is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
    /*Codes_SRS_IOTHUBCLIENT_LL_02_036: [If value is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
    if (
        (iotHubClientHandle == NULL) ||
        (optionName == NULL) ||
        (value == NULL)
        )
    {
        result = IOTHUB_CLIENT_INVALID_ARG;
        LogError("invalid argument (NULL)\r\n");
    }
    else
    {
        IOTHUB_CLIENT_LL_HANDLE_DATA* handleData = (IOTHUB_CLIENT_LL_HANDLE_DATA*)iotHubClientHandle;

        /*Codes_SRS_IOTHUBCLIENT_LL_02_038: [Otherwise, IoTHubClient_LL shall call the function _SetOption of the underlying transport and return what that function is returning.] */
        result = handleData->IoTHubTransport_SetOption(handleData->transportHandle, optionName, value);

        if (result != IOTHUB_CLIENT_OK)
        {
            LogError("underlying transport failed, returned = %s\r\n", ENUM_TO_STRING(IOTHUB_CLIENT_RESULT, result));
        }

    }
    return result;
}
开发者ID:neo7206,项目名称:azure-iot-sdks,代码行数:31,代码来源:iothub_client_ll.c


示例20: ConstructHeadersString

static HTTPAPI_RESULT ConstructHeadersString(HTTP_HEADERS_HANDLE httpHeadersHandle, char* headers, size_t headersBufferSize)
{
    HTTPAPI_RESULT result;
    size_t headersCount;
    headers[0] = '\0';

    if (HTTPHeaders_GetHeaderCount(httpHeadersHandle, &headersCount) != HTTP_HEADERS_OK)
    {
        result = HTTPAPI_HTTP_HEADERS_FAILED;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(HTTPAPI_RESULT, result));
    }
    else
    {
        size_t i;

        for (i = 0; i < headersCount; i++)
        {
            char tempBuffer[TEMP_BUFFER_SIZE];
            if (HTTPHeaders_GetHeader(httpHeadersHandle, i, tempBuffer, TEMP_BUFFER_SIZE) == HTTP_HEADERS_OK)
            {
                strcat_s(headers, headersBufferSize, tempBuffer);
                strcat_s(headers, headersBufferSize, "\r\n");
            }
        }

        result = HTTPAPI_OK;
    }

    return result;
}
开发者ID:rabbitom,项目名称:azure-c-shared-utility,代码行数:30,代码来源:httpapi_wininet.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ EOFBlob函数代码示例发布时间:2022-05-30
下一篇:
C++ ENTRY_BLOCK_PTR_FOR_FN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap