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


C++ LogErrorWithEnum函数代码示例

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


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

示例1: OperationCommon_AddPathToObjectsTree

AwaError OperationCommon_AddPathToObjectsTree(TreeNode objectsTree, const char * path, TreeNode * resultNode)
{
    AwaError result = AwaError_Unspecified;

    if (objectsTree != NULL)
    {
        if (path != NULL)
        {
            if (Path_IsValid(path))
            {
                // Drop paths that are already represented
                // E.g. /3/0/0 should be dropped if /3/0 is already present
                if (ObjectsTree_IsPathCovered(objectsTree, path, resultNode) == false)
                {
                    // if a new path that covers existing paths is added, remove any existing path nodes
                    TreeNode existing = NULL;
                    if (ObjectsTree_FindPathNode(objectsTree, path, &existing) == InternalError_Success)
                    {
                        if (resultNode != NULL)
                        {
                            *resultNode = existing;
                        }
                        ObjectsTree_RemovePathNodes(existing);
                        LogDebug("Removing nodes below %s", path);
                        result = AwaError_Success;
                    }
                    else
                    {
                        if (ObjectsTree_AddPath(objectsTree, path, resultNode) == InternalError_Success)
                        {
                            result = AwaError_Success;
                        }
                        else
                        {
                            result = LogErrorWithEnum(AwaError_Internal, "AddPath failed");
                        }
                    }
                }
                else
                {
                    LogDebug("Dropping path %s", path);
                    result = AwaError_Success;
                }
            }
            else
            {
                result = LogErrorWithEnum(AwaError_PathInvalid, "Path %s is not valid", path);
            }
        }
        else
        {
            result = LogErrorWithEnum(AwaError_PathInvalid, "Path is NULL");
        }
    }
    else
    {
        result = LogErrorWithEnum(AwaError_OperationInvalid, "Objects Tree is NULL");
    }
    return result;
}
开发者ID:DavidAntliff,项目名称:AwaLWM2M,代码行数:60,代码来源:operation_common.c

示例2: ChangeSet_GetExecuteArguments

AwaError ChangeSet_GetExecuteArguments(const AwaChangeSet *changeSet, const char * path, AwaExecuteArguments * arguments)
{
    AwaError error = AwaError_Unspecified;
    if (changeSet != NULL)
    {
        if (arguments != NULL)
        {
            AwaOpaque executePayload = {NULL, 0};
            error = AwaChangeSet_GetValueAsOpaque(changeSet, path, &executePayload);
            if (error == AwaError_Success)
            {
                arguments->Data = executePayload.Data;
                arguments->Size = executePayload.Size;
            }
        }
        else
        {
            error = LogErrorWithEnum(AwaError_OperationInvalid, "Arguments are NULL");
        }
    }
    else
    {
        error = LogErrorWithEnum(AwaError_OperationInvalid, "ChangeSet is NULL");
    }
    return error;
}
开发者ID:andreibosco,项目名称:AwaLWM2M,代码行数:26,代码来源:changeset.c

示例3: OperationCommon_NewWithExistingObjectsTree

OperationCommon * OperationCommon_NewWithExistingObjectsTree(const Session * session, SessionType sessionType, TreeNode objectsTree)
{
    OperationCommon * operation = NULL;
    if (session != NULL)
    {
        operation = Awa_MemAlloc(sizeof(*operation));
        if (operation != NULL)
        {
            memset(operation, 0, sizeof(*operation));
            operation->Session = session;
            operation->SessionType = sessionType;
            operation->ObjectsTree = objectsTree;
            if (operation->ObjectsTree != NULL)
            {
                LogNew("OperationCommon", operation);
            }
            else
            {
                LogErrorWithEnum(AwaError_Internal, "Unable to initialise operation");
                Awa_MemSafeFree(operation);
                operation = NULL;
            }
        }
        else
        {
            LogErrorWithEnum(AwaError_OutOfMemory);
        }
    }
    else
    {
        LogErrorWithEnum(AwaError_SessionInvalid, "Session is NULL");
    }
    return operation;
}
开发者ID:DavidAntliff,项目名称:AwaLWM2M,代码行数:34,代码来源:operation_common.c

示例4: StringIterator_Add

void StringIterator_Add(StringIterator * iterator, const char * string)
{
    if (iterator != NULL)
    {
        if (string != NULL)
        {
            // allocate memory, to be managed by iterator:
            char * newString = strdup(string);
            if (newString != NULL)
            {
                Iterator_Add(iterator->Iterator, newString);
            }
            else
            {
                LogErrorWithEnum(AwaError_Internal, "unable to allocate memory for string");
            }
        }
        else
        {
            LogErrorWithEnum(AwaError_Internal, "string is NULL");
        }
    }
    else
    {
        LogErrorWithEnum(AwaError_IteratorInvalid, "iterator is NULL");
    }
}
开发者ID:andreibosco,项目名称:AwaLWM2M,代码行数:27,代码来源:string_iterator.c

示例5: OperationCommon_GetSessionCommon

const SessionCommon * OperationCommon_GetSessionCommon(const OperationCommon * operation)
{
    const SessionCommon * sessionCommon = NULL;
    if (operation != NULL)
    {
        // to get the common Session, we must know what kind of session it is
        SessionType sessionType = SessionType_Invalid;
        const Session * sessionBlind = OperationCommon_GetSession(operation, &sessionType);

        // use SessionType to safely cast and dereference the Session pointer
        switch (sessionType)
        {
            case SessionType_Client:
                sessionCommon = ClientSession_GetSessionCommon((const AwaClientSession *)sessionBlind);
                break;
            case SessionType_Server:
                sessionCommon = ServerSession_GetSessionCommon((const AwaServerSession *)sessionBlind);
                break;
            default:
                LogErrorWithEnum(AwaError_Internal, "Invalid SessionType %d", sessionType);
                break;
        }
    }
    else
    {
        LogErrorWithEnum(AwaError_OperationInvalid, "operation is NULL");
    }
    return sessionCommon;
}
开发者ID:DavidAntliff,项目名称:AwaLWM2M,代码行数:29,代码来源:operation_common.c

示例6: ResponseCommon_CheckForErrors

AwaError ResponseCommon_CheckForErrors(const ResponseCommon * response)
{
    AwaError result = AwaError_Success;
    if (response != NULL)
    {
        if (response->ObjectsNode != NULL)
        {
            TreeNode currentNode = response->ObjectsNode;
            if (currentNode != NULL)
            {
                while ((currentNode = ObjectsTree_GetNextLeafNode(currentNode)) != NULL)
                {
                    // check for a Result tag
                    TreeNode resultNode = Xml_Find(currentNode, "Result");
                    if (resultNode != NULL)
                    {
                        TreeNode errorNode = Xml_Find(resultNode, "Error");
                        if (errorNode != NULL)
                        {
                            AwaError error = Error_FromString((const char *)TreeNode_GetValue(errorNode));
                            if (error != AwaError_Success)
                            {
                                result = AwaError_Response;
                            }
                            // keep looking; examine all leaf nodes
                        }
                        else
                        {
                            // result without error node - error
                            result = LogErrorWithEnum(AwaError_ResponseInvalid, "Response Result has missing Error node");
                            break;
                        }
                    }
                    else
                    {
                        // leaf without result node - error
                        result = LogErrorWithEnum(AwaError_ResponseInvalid, "Response has missing Result node");
                        break;
                    }
                }
            }
            else
            {
                result = LogErrorWithEnum(AwaError_Internal, "Response has no objects tree");
            }
        }
        else
        {
            result = LogErrorWithEnum(AwaError_Internal, "Response has no objects node");
        }
    }
    else
    {
        result = LogErrorWithEnum(AwaError_ResponseInvalid, "response is NULL");
    }
    return result;
}
开发者ID:mayank-sirotiya-imgtec,项目名称:AwaLWM2M,代码行数:57,代码来源:response_common.c

示例7: ResponseCommon_New

ResponseCommon * ResponseCommon_New(const OperationCommon * operation, TreeNode objectsNode)
{
    ResponseCommon * response = NULL;

    if (operation != NULL)
    {
        if (objectsNode != NULL)
        {
            response = Awa_MemAlloc(sizeof(*response));
            if (response != NULL)
            {
                memset(response, 0, sizeof(*response));
                response->OperationCommon = operation;
                response->ObjectsNode = Tree_Copy(objectsNode);

                // build the Values data structure
                if (ResponseCommon_BuildValues(response) == AwaError_Success)
                {
                    // not all responses have Values, so success includes no values
                }
                else
                {
                    // there was an error building values
                    LogDebug("Failed to build response values - continuing");
                }

                if (ResponseCommon_BuildPathResults(response) == AwaError_Success)
                {
                    // not all responses have path results
                }
                else
                {
                    // there was an error building values
                    LogErrorWithEnum(AwaError_ResponseInvalid, "Failed to build path results - continuing");
                }

                response->NulledValues = Map_New();

                LogNew("ResponseCommon", response);

            }
            else
            {
                LogErrorWithEnum(AwaError_OutOfMemory);
            }
        }
        else
        {
            LogError("Content Response is NULL");
        }
    }
    else
    {
        LogError("Operation is NULL");
    }
    return response;
}
开发者ID:mayank-sirotiya-imgtec,项目名称:AwaLWM2M,代码行数:57,代码来源:response_common.c

示例8: AwaClientSetOperation_CreateObjectInstance

AwaError AwaClientSetOperation_CreateObjectInstance(AwaClientSetOperation * operation, const char * path)
{
    AwaError result = AwaError_Unspecified;

    if (path != NULL)
    {
        AwaObjectID objectID;
        AwaResourceID resourceID;

        if (Path_IsValid(path))
        {
            objectID = Path_GetObjectID(path);
            resourceID = Path_GetResourceID(path);

            if ((objectID != AWA_INVALID_ID) && (resourceID == AWA_INVALID_ID))
            {
                if (operation != NULL)
                {
                    TreeNode resultNode;
                    if ((result = OperationCommon_AddPathV2(operation->Common, path, &resultNode)) == AwaError_Success && resultNode != NULL)
                    {
                        //NB: if object instance ID isn't specified in the path we have to check the response for the generated ID
                        if (ClientSetOperation_AddCreate(resultNode) == InternalError_Success)
                        {
                            result = AwaError_Success;
                        }
                        else
                        {
                            result = LogErrorWithEnum(AwaError_Internal, "Failed to add value to path");
                        }
                    }
                }
                else
                {
                    result = LogErrorWithEnum(AwaError_OperationInvalid, "Operation is NULL");
                }
            }
            else
            {
                result = LogErrorWithEnum(AwaError_PathInvalid,  "%s is not a valid object or object instance path", path);
            }
        }
        else
        {
            result = LogErrorWithEnum(AwaError_PathInvalid,  "%s is not a valid path", path);
        }
    }
    else
    {
        result = LogErrorWithEnum(AwaError_PathInvalid, "Path is NULL");
    }
    return result;
}
开发者ID:TonyWalsworthImg,项目名称:AwaLWM2M,代码行数:53,代码来源:set_operation.c

示例9: AwaClientSubscribeOperation_New

AwaClientSubscribeOperation * AwaClientSubscribeOperation_New(const AwaClientSession * session)
{
    AwaClientSubscribeOperation * operation = NULL;

    if (session != NULL)
    {
        if (ClientSession_IsConnected(session) != false)
        {
            operation = Awa_MemAlloc(sizeof(*operation));
            if (operation != NULL)
            {
                memset(operation, 0, sizeof(*operation));
                operation->Common = OperationCommon_NewWithClientSession(session);
                if (operation->Common != NULL)
                {
                    operation->Subscribers = Map_New();

                    if (operation->Subscribers != NULL)
                    {
                        LogNew("AwaClientSubscribeOperation", operation);
                    }
                    else
                    {
                        LogErrorWithEnum(AwaError_OutOfMemory, "Could not create subscriber list.");
                        Awa_MemSafeFree(operation);
                        operation = NULL;
                    }
                }
                else
                {
                    LogErrorWithEnum(AwaError_Internal, "Unable to initialise operation.");
                    Awa_MemSafeFree(operation);
                    operation = NULL;
                }
            }
            else
            {
                LogErrorWithEnum(AwaError_OutOfMemory);
            }
        }
        else
        {
            LogError("Session is not connected");
        }
    }
    else
    {
        LogError("Session is NULL");
    }
    return operation;
}
开发者ID:DavidAntliff,项目名称:AwaLWM2M,代码行数:51,代码来源:client_subscribe.c

示例10: AwaServerExecuteOperation_AddPath

AwaError AwaServerExecuteOperation_AddPath(AwaServerExecuteOperation * operation, const char * clientID, const char * path, const AwaExecuteArguments * arguments)
{
    AwaError result = AwaError_Unspecified;

    if (operation != NULL)
    {
        if (Path_IsValidForResource(path))
        {
            TreeNode resultNode = NULL;
            if ((result = ServerOperation_AddPath(operation->ServerOperation, clientID, path, &resultNode)) == AwaError_Success)
            {
                if (resultNode != NULL)
                {
                    char * encodedValue = NULL;
                    if (arguments != NULL && arguments->Size > 0)
                    {
                        encodedValue = xmlif_EncodeValue(AwaResourceType_Opaque, arguments->Data, arguments->Size);
                    }

                    if (encodedValue == NULL || SetWriteCommon_SetResourceNodeValue(resultNode, encodedValue) == InternalError_Success)
                    {
                        result = AwaError_Success;
                    }
                    else
                    {
                        result = LogErrorWithEnum(AwaError_Internal, "Failed to set resource value");
                    }

                    if (encodedValue)
                    {
                        Awa_MemSafeFree(encodedValue);
                    }
                }
                else
                {
                    result = LogErrorWithEnum(AwaError_Internal, "AddPath failed to return result node");
                }
            }
        }
        else
        {
            result = LogErrorWithEnum(AwaError_PathInvalid, "%s is not a valid path to an executable resource", path);
        }
    }
    else
    {
        result = LogErrorWithEnum(AwaError_OperationInvalid, "Operation is NULL");
    }
    return result;
}
开发者ID:DavidAntliff,项目名称:AwaLWM2M,代码行数:50,代码来源:execute_operation.c

示例11: ClientSetOperation_AddValues

static AwaError ClientSetOperation_AddValues(AwaClientSetOperation * operation, const char * path, const AwaArray * array, AwaResourceType type)
{
    AwaError result = AwaError_Unspecified;

    AwaArrayIterator * iterator = ArrayIterator_New(array);

    if (iterator)
    {
        while(ArrayIterator_Next(iterator))
        {
            AwaArrayIndex index = ArrayIterator_GetIndex(iterator);
            void * value = ArrayIterator_GetValue(iterator);
            size_t length = ArrayIterator_GetValueLength(iterator);

            if (type == AwaResourceType_OpaqueArray)
            {
                AwaOpaque * opaque = value;
                value = opaque->Data;
                length = opaque->Size;
            }

            LogDebug("Adding value %p", value);

            if (value)
            {
                result = ClientSetOperation_AddValue(operation, path, index, value, length, type, SetArrayMode_Replace);
                if (result != AwaError_Success)
                {
                    LogError("Unable to add array resource Instance");
                    break;
                }
            }
            else
            {
                result = LogErrorWithEnum(AwaError_Internal , "Problem with array");
                break;
            }
        }

        ArrayIterator_Free(&iterator);
    }
    else
    {
        result = LogErrorWithEnum(AwaError_OperationInvalid, "Operation is NULL");
    }

    return result;
}
开发者ID:TonyWalsworthImg,项目名称:AwaLWM2M,代码行数:48,代码来源:set_operation.c

示例12: AwaServerSession_Process

AwaError AwaServerSession_Process(AwaServerSession * session, AwaTimeout timeout)
{
    AwaError result = AwaError_Unspecified;

    if (session != NULL)
    {
        while (IPC_WaitForNotification(ServerSession_GetChannel(session), timeout) == AwaError_Success)
        {
            IPCMessage * notification;
            if (IPC_ReceiveNotification(ServerSession_GetChannel(session), &notification) == AwaError_Success)
            {
                if (!Queue_Push(session->NotificationQueue, notification))
                {
                    // Queue full?
                    IPCMessage_Free(&notification);
                }
            }
            // we have received at least 1 packet, so we no longer have any reason to wait
            // if there are no more in the pipeline.
            timeout = 0;
        }

        result = AwaError_Success;
    }
    else
    {
        LogErrorWithEnum(AwaError_SessionInvalid, "session is NULL");
    }
    return result;
}
开发者ID:andreibosco,项目名称:AwaLWM2M,代码行数:30,代码来源:server_session.c

示例13: ResponseCommon_NewClient

// FIXME Currently The client is using the old xml spec and therefore can't be used with the new objects tree.
// This is a temporary workaround to prevent error messages when the response does not contain an 'Objects' node
ResponseCommon * ResponseCommon_NewClient(const OperationCommon * operation, TreeNode objectsNode)
{
    ResponseCommon * response = NULL;

    if (operation != NULL)
    {
        if (objectsNode != NULL)
        {
            response = Awa_MemAlloc(sizeof(*response));
            if (response != NULL)
            {
                memset(response, 0, sizeof(*response));
                response->OperationCommon = operation;
                response->ObjectsNode = Tree_Copy(objectsNode);
                LogNew("ResponseCommon", response);
            }
            else
            {
                LogErrorWithEnum(AwaError_OutOfMemory);
            }
        }
        else
        {
            LogError("Content Response is NULL");
        }
    }
    else
    {
        LogError("Operation is NULL");
    }
    return response;
}
开发者ID:mayank-sirotiya-imgtec,项目名称:AwaLWM2M,代码行数:34,代码来源:response_common.c

示例14: ChangeSet_NewWithClientID

AwaChangeSet * ChangeSet_NewWithClientID(Session * session, SessionType sessionType, TreeNode objectsTree, const char * clientID)
{
    AwaChangeSet * changeSet = NULL;
    if (objectsTree != NULL)
    {
        changeSet = Awa_MemAlloc(sizeof(*changeSet));
        if (changeSet != NULL)
        {
            memset(changeSet, 0, sizeof(*changeSet));

            changeSet->OperationCommon = OperationCommon_New(session, sessionType);

            if (changeSet->OperationCommon != NULL)
            {
                changeSet->ResponseCommon = ResponseCommon_New(changeSet->OperationCommon, objectsTree);
                if (changeSet->ResponseCommon != NULL)
                {
                    changeSet->ClientID = clientID;
                    LogNew("AwaChangeSet New", changeSet);
                }
                else
                {
                    LogErrorWithEnum(AwaError_OutOfMemory);
                    OperationCommon_Free(&changeSet->OperationCommon);
                    Awa_MemSafeFree(changeSet);
                    changeSet = NULL;
                }
            }
            else
            {
                LogErrorWithEnum(AwaError_OutOfMemory);
                Awa_MemSafeFree(changeSet);
                changeSet = NULL;
            }
        }
        else
        {
            LogErrorWithEnum(AwaError_OutOfMemory);
        }
    }
    else
    {
        LogErrorWithEnum(AwaError_OperationInvalid, "Objects tree is NULL");
    }
    return changeSet;
}
开发者ID:andreibosco,项目名称:AwaLWM2M,代码行数:46,代码来源:changeset.c

示例15: AwaChangeSet_GetSession

static const Session * AwaChangeSet_GetSession(const AwaChangeSet * changeSet, SessionType sessionType)
{
    const Session * session = NULL;
    if (changeSet != NULL)
    {
        SessionType actualSessionType = SessionType_Invalid;
        session = OperationCommon_GetSession(ResponseCommon_GetOperation(changeSet->ResponseCommon), &actualSessionType);
        if (sessionType != actualSessionType)
        {
            LogErrorWithEnum(AwaError_OperationInvalid, "Changeset does not hold a session of type %d. Requesting Session type %d\n", actualSessionType, sessionType);
            session = NULL;
        }
    }
    else
    {
        LogErrorWithEnum(AwaError_OperationInvalid, "ChangeSet is NULL");
    }
    return session;
}
开发者ID:andreibosco,项目名称:AwaLWM2M,代码行数:19,代码来源:changeset.c


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