本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}