// Delete a subscription from the set. void SubscriptionSet::deleteInstance(const char* instanceName, const char* subscriptionState, const char* resourceSubscriptionState) { OsSysLog::add(FAC_RLS, PRI_DEBUG, "SubscriptionSet::deleteInstance instanceName = '%s', subscriptionState = '%s'", instanceName, subscriptionState); // Search for the resource instance in question. UtlSListIterator itor(mSubscriptions); ResourceInstance* inst; UtlBoolean found = FALSE; while (!found && (inst = dynamic_cast <ResourceInstance*> (itor()))) { if (inst->getInstanceName()->compareTo(instanceName) == 0) { found = TRUE; // Set the state of the resource instance to terminated. // This call sets the containing ResourceList's to publish, // eventually. inst->terminateContent(subscriptionState); // We do not remove the element from mSubscriptions, but rather // let it be removed by ResourceCache::purgeTerminated(). } } if (!found) { OsSysLog::add(FAC_RLS, PRI_WARNING, "SubscriptionSet::deleteInstance instanceName = '%s' not found", instanceName); } }
// Find a subscription in the set. ResourceInstance* SubscriptionSet::getInstance(const char* instanceName) { Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "SubscriptionSet::getInstance instanceName = '%s'", instanceName); // Search for the resource instance in question. UtlSListIterator itor(mSubscriptions); ResourceInstance* inst; UtlBoolean found = FALSE; while (!found && (inst = dynamic_cast <ResourceInstance*> (itor()))) { if (inst->getInstanceName()->compareTo(instanceName) == 0) { found = TRUE; } } return inst; }