| 867 | } |
| 868 | |
| 869 | DDS::ReturnCode_t |
| 870 | SubscriberImpl::enable() |
| 871 | { |
| 872 | //According spec: |
| 873 | // - Calling enable on an already enabled Entity returns OK and has no |
| 874 | // effect. |
| 875 | // - Calling enable on an Entity whose factory is not enabled will fail |
| 876 | // and return PRECONDITION_NOT_MET. |
| 877 | |
| 878 | if (this->is_enabled()) { |
| 879 | return DDS::RETCODE_OK; |
| 880 | } |
| 881 | |
| 882 | RcHandle<DomainParticipantImpl> participant = this->participant_.lock(); |
| 883 | if (!participant || !participant->is_enabled()) { |
| 884 | return DDS::RETCODE_PRECONDITION_NOT_MET; |
| 885 | } |
| 886 | |
| 887 | dp_id_ = participant->get_id(); |
| 888 | |
| 889 | if (this->monitor_) { |
| 890 | this->monitor_->report(); |
| 891 | } |
| 892 | |
| 893 | this->set_enabled(); |
| 894 | |
| 895 | if (qos_.entity_factory.autoenable_created_entities) { |
| 896 | DataReaderSet readers; |
| 897 | { |
| 898 | ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, si_lock_, DDS::RETCODE_ERROR); |
| 899 | readers_not_enabled_.swap(readers); |
| 900 | } |
| 901 | for (DataReaderSet::iterator it = readers.begin(); it != readers.end(); ++it) { |
| 902 | (*it)->enable(); |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | return DDS::RETCODE_OK; |
| 907 | } |
| 908 | |
| 909 | bool SubscriberImpl::is_clean(String* leftover_entities) const |
| 910 | { |
no test coverage detected