这篇教程C++ ENUM_TO_STRING函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ENUM_TO_STRING函数的典型用法代码示例。如果您正苦于以下问题:C++ ENUM_TO_STRING函数的具体用法?C++ ENUM_TO_STRING怎么用?C++ ENUM_TO_STRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ENUM_TO_STRING函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: JSONEncoder_CharPtr_ToStringJSON_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,
示例2: MultiTree_GetValueMULTITREE_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,
示例3: LockLOCK_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,
示例4: ThreadAPI_JoinTHREADAPI_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,
示例5: ThreadAPI_CreateTHREADAPI_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,
示例6: DataPublisher_StartTransactionTRANSACTION_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,
示例7: serializer_initSERIALIZER_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,
示例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,
示例9: UnlockLOCK_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,
示例10: HTTPHeaders_GetHeaderCountHTTP_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,
示例11: ThreadAPI_JoinTHREADAPI_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,
示例12: Lock_DeinitLOCK_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,
示例13: DataMarshaller_CreateDATA_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,
示例14: MultiTree_GetChildMULTITREE_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,
示例15: ENUM_TO_STRINGboost::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,
示例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,
示例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,
示例18: ThreadAPI_CreateTHREADAPI_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,
示例19: IoTHubClient_LL_SetOptionIOTHUB_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,
示例20: ConstructHeadersStringstatic 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,
示例21: IoTHubMessage_GetByteArrayIOTHUB_MESSAGE_RESULT IoTHubMessage_GetByteArray(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const unsigned char** buffer, size_t* size){ IOTHUB_MESSAGE_RESULT result; if ( (iotHubMessageHandle == NULL) || (buffer == NULL) || (size == NULL) ) { /*Codes_SRS_IOTHUBMESSAGE_01_014: [If any of the arguments passed to IoTHubMessage_GetByteArray is NULL IoTHubMessage_GetByteArray shall return IOTHUBMESSAGE_INVALID_ARG.] */ LogError("invalid parameter (NULL) to IoTHubMessage_GetByteArray IOTHUB_MESSAGE_HANDLE iotHubMessageHandle=%p, const unsigned char** buffer=%p, size_t* size=%p/r/n", iotHubMessageHandle, buffer, size); result = IOTHUB_MESSAGE_INVALID_ARG; } else { IOTHUB_MESSAGE_HANDLE_DATA* handleData = iotHubMessageHandle; if (handleData->contentType != IOTHUBMESSAGE_BYTEARRAY) { /*Codes_SRS_IOTHUBMESSAGE_02_021: [If iotHubMessageHandle is not a iothubmessage containing BYTEARRAY data, then IoTHubMessage_GetData shall write in *buffer NULL and shall set *size to 0.] */ result = IOTHUB_MESSAGE_INVALID_ARG; LogError("invalid type of message %s/r/n", ENUM_TO_STRING(IOTHUBMESSAGE_CONTENT_TYPE, handleData->contentType)); } else { /*Codes_SRS_IOTHUBMESSAGE_01_011: [The pointer shall be obtained by using BUFFER_u_char and it shall be copied in the buffer argument.]*/ *buffer = BUFFER_u_char(handleData->value.byteArray); /*Codes_SRS_IOTHUBMESSAGE_01_012: [The size of the associated data shall be obtained by using BUFFER_length and it shall be copied to the size argument.]*/ *size = BUFFER_length(handleData->value.byteArray); result = IOTHUB_MESSAGE_OK; } } return result;}
开发者ID:ms-iot,项目名称:security,代码行数:33,
示例22: if//______________________________________________________________________________void shutterInterface::staticEntryShutterMonitor( const event_handler_args args ){ /// recast args.usr ( a void * ) to a monitor struct pointer shutterStructs::monitorStuct * ms = reinterpret_cast<shutterStructs::monitorStuct*>(args.usr); /// Not sure how to decode these apart from trial and error /// you can test with DBF_STRING as the callback type if( *(unsigned short*)args.dbr == 0 ) ms -> shutObj -> shutterState = VELA_ENUM::SHUTTER_STATE::SHUTTER_CLOSED; else if( *(unsigned short*)args.dbr == 1 ) ms -> shutObj -> shutterState = VELA_ENUM::SHUTTER_STATE::SHUTTER_OPEN; else ms -> shutObj -> shutterState = VELA_ENUM::SHUTTER_STATE::SHUTTER_ERROR; /// make debug messages easier to understand by using ENUM_TO_STRING ms -> interface -> debugMessage( ms -> shutObj -> name, " new state = ", ENUM_TO_STRING(ms->shutObj -> shutterState )); /// If subscribed to DBF_STRING use this to get the message //char * val = (char *)args.dbr; /// now we can switch based on the monitor type and then update the correct part of the shutter object data using val /// For the shutter this is basically redundant, there is only one monitor the "Sta" /// (apart from interlocks, these are handled in the base class)// switch( lms.monType )// {// case shutterStructs::Sta:// ....// case SomeOtherPVType:// ....// }}
开发者ID:adb-xkc85723,项目名称:VELA-CLARA-Controllers,代码行数:32,
示例23: foreach foreach (TransactionProxy* transaction, m_transactions) { QVariantMap props; props["name"] = transaction->name(); props["data"] = transaction->data(); props["role"] = ENUM_TO_STRING(Role,transaction->role()); tlist.append(props); }
开发者ID:SfietKonstantin,项目名称:orn-warehouse,代码行数:7,
示例24: ThreadAPI_JoinTHREADAPI_RESULT ThreadAPI_Join(THREAD_HANDLE threadHandle, int *res){ THREADAPI_RESULT result = THREADAPI_OK; if (threadHandle == NULL) { result = THREADAPI_INVALID_ARG; LogError("(result = %s)/r/n", ENUM_TO_STRING(THREADAPI_RESULT, result)); } else { DWORD returnCode = WaitForSingleObject(threadHandle, INFINITE); if( returnCode != WAIT_OBJECT_0) { result = THREADAPI_ERROR; LogError("Error waiting for Single Object. Return Code: %d. Error Code: %d/r/n", returnCode); } else if((res != NULL) && !GetExitCodeThread(threadHandle, res)) //If thread end is signaled we need to get the Thread Exit Code; { DWORD errorCode = GetLastError(); result = THREADAPI_ERROR; LogError("Error Getting Exit Code. Error Code: %d./r/n", errorCode); } CloseHandle(threadHandle); } return result;}
开发者ID:ashokkhurana,项目名称:azure-c-shared-utility,代码行数:29,
示例25: sendCallbackvoid sendCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback){ int messageTrackingId = (intptr_t)userContextCallback; (void)printf("Message Id: %d Received./r/n", messageTrackingId); (void)printf("Result Call Back Called! Result is: %s /r/n", ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result));}
开发者ID:Attunix,项目名称:iot-hub-c-m0,代码行数:8,
示例26: on_umock_c_errorstaticvoidon_umock_c_error( UMOCK_C_ERROR_CODE error_code) { char temp_str[256]; (void)snprintf(temp_str, sizeof(temp_str), "umock_c reported error :%s", ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code)); ASSERT_FAIL(temp_str);}
开发者ID:avranju,项目名称:azure-iot-gateway-sdk,代码行数:9,
示例27: ENUM_TO_STRING//______________________________________________________________________________std::map< VELA_ENUM::ILOCK_NUMBER, std::string > beamPositionMonitorInterface::getILockStatesStr( const std::string & name ){ std::map< VELA_ENUM::ILOCK_NUMBER, std::string > r; auto iter = allBPMData.find( name ); if( iter != allBPMData.end() ) for( auto it : iter -> second.iLockStates ) r[ it.first ] = ENUM_TO_STRING( it.second ); return r;}
开发者ID:adb-xkc85723,项目名称:VELA-CLARA-Controllers,代码行数:10,
示例28: DataPublisher_CreateDATA_PUBLISHER_HANDLE DataPublisher_Create(SCHEMA_MODEL_TYPE_HANDLE modelHandle, bool includePropertyPath){ DATA_PUBLISHER_HANDLE result; DATA_PUBLISHER_INSTANCE* dataPublisherInstance; /* Codes_SRS_DATA_PUBLISHER_99_042:[ If a NULL argument is passed to it, DataPublisher_Create shall return NULL.] */ if ( (modelHandle == NULL) ) { result = NULL; LogError("(result = %s)/r/n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_INVALID_ARG)); } else if ((dataPublisherInstance = (DATA_PUBLISHER_INSTANCE*)malloc(sizeof(DATA_PUBLISHER_INSTANCE))) == NULL) { /* Codes_SRS_DATA_PUBLISHER_99_047:[ For any other error not specified here, DataPublisher_Create shall return NULL.] */ result = NULL; LogError("(result = %s)/r/n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_ERROR)); } else { /* Codes_SRS_DATA_PUBLISHER_99_043:[ DataPublisher_Create shall initialize and hold a handle to a DataMarshaller instance.] */ /* Codes_SRS_DATA_PUBLISHER_01_001: [DataPublisher_Create shall pass the includePropertyPath argument to DataMarshaller_Create.] */ if ((dataPublisherInstance->DataMarshallerHandle = DataMarshaller_Create(modelHandle, includePropertyPath)) == NULL) { free(dataPublisherInstance); /* Codes_SRS_DATA_PUBLISHER_99_044:[ If the creation of the DataMarshaller instance fails, DataPublisher_Create shall return NULL.] */ result = NULL; LogError("(result = %s)/r/n", ENUM_TO_STRING(DATA_PUBLISHER_RESULT, DATA_PUBLISHER_MARSHALLER_ERROR)); } else { dataPublisherInstance->ModelHandle = modelHandle; /* Codes_SRS_DATA_PUBLISHER_99_041:[ DataPublisher_Create shall create a new DataPublisher instance and return a non-NULL handle in case of success.] */ result = dataPublisherInstance; } } return result;}
开发者ID:Ahmed-Salama,项目名称:Project_JAR,代码行数:42,
示例29: MultiTree_GetChildByName/* Codes_SRS_MULTITREE_99_063:[ MultiTree_GetChildByName shall retrieve the handle of the child node childName from the treeNode node.] */MULTITREE_RESULT MultiTree_GetChildByName(MULTITREE_HANDLE treeHandle, const char* childName, MULTITREE_HANDLE *childHandle){ MULTITREE_RESULT result; /* Codes_SRS_MULTITREE_99_065:[ If any argument is NULL, MultiTree_GetChildByName shall return MULTITREE_INVALID_ARG.] */ if ((treeHandle == NULL) || (childHandle == NULL) || (childName == NULL)) { result = MULTITREE_INVALID_ARG; LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result)); } else { MULTITREE_HANDLE_DATA * node = (MULTITREE_HANDLE_DATA *)treeHandle; size_t i; for (i = 0; i < node->nChildren; i++) { if (strcmp(node->children[i]->name, childName) == 0) { break; } } if (i == node->nChildren) { /* Codes_SRS_MULTITREE_99_068:[ If the specified child is not found, MultiTree_GetChildByName shall return MULTITREE_CHILD_NOT_FOUND.] */ result = MULTITREE_CHILD_NOT_FOUND; LogError("(result = %s)", ENUM_TO_STRING(MULTITREE_RESULT, result)); } else { /* Codes_SRS_MULTITREE_99_067:[ The child node handle shall be returned in the childHandle argument.] */ *childHandle = node->children[i]; /* Codes_SRS_MULTITREE_99_064:[ On success, MultiTree_GetChildByName shall return MULTITREE_OK.] */ result = MULTITREE_OK; } } return result;}
开发者ID:mohesk,项目名称:azure-iot-sdks,代码行数:43,
示例30: if//______________________________________________________________________________void scopeConfigReader::addToPVStruct( std::vector< scopeStructs::pvStruct > & pvStruct_v, const std::vector<std::string> &keyVal ){ if( stringIsSubString( keyVal[0], "SUFFIX" ) ) { pvStruct_v.push_back( scopeStructs::pvStruct() ); /// Any way to avoid the ladders? pvStruct_v.back().pvSuffix = keyVal[1]; // NUMBER PVs if( keyVal[0] == UTL::PV_SUFFIX_P1 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::P1; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::NUM; } else if( keyVal[0] == UTL::PV_SUFFIX_P2 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::P2; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::NUM; } else if( keyVal[0] == UTL::PV_SUFFIX_P3 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::P3; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::NUM; } else if( keyVal[0] == UTL::PV_SUFFIX_P4 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::P4; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::NUM; } // TRACE PVs else if( keyVal[0] == UTL::PV_SUFFIX_TR1 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::TR1; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::ARRAY; } else if( keyVal[0] == UTL::PV_SUFFIX_TR2 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::TR2; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::ARRAY; } else if( keyVal[0] == UTL::PV_SUFFIX_TR3 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::TR3; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::ARRAY; } else if( keyVal[0] == UTL::PV_SUFFIX_TR4 ) { pvStruct_v.back().pvType = scopeStructs::SCOPE_PV_TYPE::TR4; pvStruct_v.back().scopeType = scopeStructs::SCOPE_TYPE::ARRAY; } debugMessage("Added ", pvStruct_v.back().pvSuffix, " suffix for ", ENUM_TO_STRING( pvStruct_v.back().pvType) ) ; } else addCOUNT_MASK_OR_CHTYPE( pvStruct_v, keyVal );}
开发者ID:adb-xkc85723,项目名称:VELA-CLARA-Controllers,代码行数:54,
注:本文中的ENUM_TO_STRING函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ EOFBlob函数代码示例 C++ ENTRY_BLOCK_PTR_FOR_FN函数代码示例 |