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


C++ Status::addDiagnostic方法代码示例

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


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

示例1: manuallyUnsubscribe

    // Manual unsubscription
    //==============================================================================================
    Status SubscriptionFactory::manuallyUnsubscribe(
            ClientSubscriptionHandle clientSubscriptionHandle)
    {
        Status ret;
        Subscription* subscription = 0;

        ret = acquireExistingSubscription(clientSubscriptionHandle, subscription);

        if (ret.isGood())
        {
            ret = subscription->deleteSubscription();
            releaseSubscription(subscription);
        }
        else
        {
            ret.addDiagnostic("Could not manually unsubscribe");
            logger_->error(ret);
        }

        return ret;
    }
开发者ID:mparkin,项目名称:uaf,代码行数:23,代码来源:subscriptionfactory.cpp

示例2: manuallySubscribe

    // Manual subscription
    //==============================================================================================
    Status SubscriptionFactory::manuallySubscribe(
            const SubscriptionSettings& settings,
            ClientSubscriptionHandle&   clientSubscriptionHandle)
    {
        Status ret;
        Subscription* subscription = 0;

        ret = acquireSubscription(settings, subscription);

        if (ret.isGood())
        {
            clientSubscriptionHandle = subscription->clientSubscriptionHandle();

            ret = releaseSubscription(subscription);
        }
        else
        {
            ret.addDiagnostic("Could not manually subscribe");
            logger_->error(ret);
        }

        return ret;
    }
开发者ID:mparkin,项目名称:uaf,代码行数:25,代码来源:subscriptionfactory.cpp

示例3: createSubscription

    Status Subscription::createSubscription()
    {

        logger_->debug("Creating the subscription to the server");

        Status ret;

        UaClientSdk::ServiceSettings serviceSettings;

        UaClientSdk::SubscriptionSettings subscriptionSettings;
        subscriptionSettings = toSdk(subscriptionSettings_);

        UaStatus uaStatus = uaSession_->createSubscription(
                serviceSettings,
                uaSubscriptionCallback_,
                clientSubscriptionHandle_,
                subscriptionSettings,
                OpcUa_True,
                &uaSubscription_);

        ret.fromSdk(uaStatus.statusCode(), "Could not create the subscription to the server");

        if (ret.isGood())
        {
            subscriptionState_ = uafc::subscriptionstates::Created;
            logger_->debug("The subscription has been successfully created to the server");
        }
        else
        {
            subscriptionState_ = uafc::subscriptionstates::Deleted;
            ret.addDiagnostic("Subscription creation to the server failed");
            logger_->error(ret);
        }

        return ret;
    }
开发者ID:mparkin,项目名称:uaf,代码行数:36,代码来源:subscription.cpp

示例4: acquireSubscription


//.........这里部分代码省略.........
        logger_->debug(subscriptionSettings.toString());

        Status ret;

        subscription = 0;

        // lock the mutex to make sure the subscriptionMap_ is not being manipulated
        UaMutexLocker locker(&subscriptionMapMutex_);

        // we'll try to find a similar subscription that can be re-used,
        // unless we're creating an "unique" subscription
        // (one that is only created for -and used by- the current request)
        if (subscriptionSettings.unique)
        {
            logger_->debug("The requested subscription must be unique");
        }
        else
        {
            // loop trough the subscriptions ...
            for (SubscriptionMap::const_iterator it = subscriptionMap_.begin();
                 it != subscriptionMap_.end();
                 ++it)
            {
                // ... until a suitable one is found
                if (it->second->subscriptionSettings() == subscriptionSettings)
                {
                    subscription = it->second;
                    logger_->debug("A suitable subscription (ClientSubscriptionHandle=%d) already exists",
                                   subscription->clientSubscriptionHandle());

                    // get the ClientSubscriptionHandle of the subscription
                    ClientSubscriptionHandle handle = subscription->clientSubscriptionHandle();

                    // now increment the activity count of the subscription
                    activityMapMutex_.lock();
                    activityMap_[handle] = activityMap_[handle] + 1;
                    activityMapMutex_.unlock();

                    ret.setGood();

                    break;
                }
            }
        }

        // if no subscription exists yet, we create one
        if (subscription == 0)
        {
            ClientSubscriptionHandle clientSubscriptionHandle;
            clientSubscriptionHandle = database_->createUniqueClientSubscriptionHandle();

            logger_->debug("We create a new subscription with clientSubscriptionHandle %d",
                           clientSubscriptionHandle);

            // create a new subscription instance
            subscription = new Subscription(
                    logger_->loggerFactory(),
                    subscriptionSettings,
                    clientSubscriptionHandle,
                    clientConnectionId_,
                    uaSession_,
                    this,
                    clientInterface_,
                    database_);

            // store the new subscription instance in the subscriptionMap
            subscriptionMap_[clientSubscriptionHandle] = subscription;

            logger_->debug("The new subscription has been created");

            // create an activity count for the subscription
            activityMapMutex_.lock();
            activityMap_[clientSubscriptionHandle] = 1;
            activityMapMutex_.unlock();

            // create the subscription on the server
            ret = subscription->createSubscription();
        }

        // 'subscription' now points to an existing Subscription instance
        // (i.e. a valid memory location)

        ret.setGood();


        // add some diagnostics
        if (ret.isGood())
        {
            activityMapMutex_.lock();
            logger_->debug("The requested subscription is acquired (#activities: %d)",
                           activityMap_[subscription->clientSubscriptionHandle()]);
            activityMapMutex_.unlock();
        }
        else
        {
            logger_->error("The requested subscription could not be acquired");
            ret.addDiagnostic("The requested subscription could not be acquired");
        }
        return ret;
    }
开发者ID:mparkin,项目名称:uaf,代码行数:101,代码来源:subscriptionfactory.cpp


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