OpenDDS::DCPS::ConditionImpl Class Reference

#include <ConditionImpl.h>

Inheritance diagram for OpenDDS::DCPS::ConditionImpl:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::ConditionImpl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DDS::ReturnCode_t attach_to_ws (DDS::WaitSet_ptr ws)
DDS::ReturnCode_t detach_from_ws (DDS::WaitSet_ptr ws)
void signal_all ()

Protected Member Functions

 ConditionImpl ()
virtual ~ConditionImpl ()
typedef OPENDDS_SET_CMP (DDS::WaitSet_var, VarLess< DDS::WaitSet >) WaitSetSet

Protected Attributes

WaitSetSet waitsets_
ACE_Recursive_Thread_Mutex lock_

Detailed Description

Definition at line 25 of file ConditionImpl.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::ConditionImpl::ConditionImpl (  )  [inline, protected]

Definition at line 33 of file ConditionImpl.h.

00033 {}

virtual OpenDDS::DCPS::ConditionImpl::~ConditionImpl (  )  [inline, protected, virtual]

Definition at line 34 of file ConditionImpl.h.

00034 {}


Member Function Documentation

DDS::ReturnCode_t OpenDDS::DCPS::ConditionImpl::attach_to_ws ( DDS::WaitSet_ptr  ws  ) 

Definition at line 43 of file ConditionImpl.cpp.

References DDS::WaitSet::_duplicate(), lock_, DDS::RETCODE_OK, DDS::RETCODE_OUT_OF_RESOURCES, DDS::RETCODE_PRECONDITION_NOT_MET, and waitsets_.

00044 {
00045   DDS::WaitSet_var wsv(DDS::WaitSet::_duplicate(ws));
00046   ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, g, lock_,
00047                    DDS::RETCODE_OUT_OF_RESOURCES);
00048   return waitsets_.insert(wsv).second
00049          ? DDS::RETCODE_OK : DDS::RETCODE_PRECONDITION_NOT_MET;
00050 }

DDS::ReturnCode_t OpenDDS::DCPS::ConditionImpl::detach_from_ws ( DDS::WaitSet_ptr  ws  ) 

Definition at line 52 of file ConditionImpl.cpp.

References DDS::WaitSet::_duplicate(), lock_, DDS::RETCODE_OK, DDS::RETCODE_OUT_OF_RESOURCES, DDS::RETCODE_PRECONDITION_NOT_MET, and waitsets_.

00053 {
00054   DDS::WaitSet_var wsv(DDS::WaitSet::_duplicate(ws));
00055   ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, g, lock_,
00056                    DDS::RETCODE_OUT_OF_RESOURCES);
00057   return waitsets_.erase(wsv)
00058          ? DDS::RETCODE_OK : DDS::RETCODE_PRECONDITION_NOT_MET;
00059 }

typedef OpenDDS::DCPS::ConditionImpl::OPENDDS_SET_CMP ( DDS::WaitSet_var  ,
VarLess< DDS::WaitSet  
) [protected]

void OpenDDS::DCPS::ConditionImpl::signal_all (  ) 

Definition at line 14 of file ConditionImpl.cpp.

References OpenDDS::DCPS::DCPS_debug_level, DDS::Condition::get_trigger_value(), lock_, and waitsets_.

Referenced by OpenDDS::DCPS::StatusConditionImpl::set_enabled_statuses(), and DDS::GuardCondition::set_trigger_value().

00015 {
00016   if (DCPS_debug_level > 9) {
00017     ACE_DEBUG((LM_DEBUG,
00018                ACE_TEXT("(%P|%t) ConditionImpl::signal_all()\n")));
00019   }
00020 
00021   if (!get_trigger_value()) return;
00022 
00023   WaitSetSet local_ws;
00024   {
00025     ACE_GUARD(ACE_Recursive_Thread_Mutex, g, lock_);
00026     local_ws = waitsets_;
00027   }
00028 
00029   if (DCPS_debug_level > 9) {
00030     ACE_DEBUG((LM_DEBUG,
00031                ACE_TEXT("(%P|%t) ConditionImpl::signal_all() - ")
00032                ACE_TEXT("number of sets: %d, locally: %d.\n"),
00033                this->waitsets_.size(),
00034                local_ws.size()));
00035   }
00036 
00037   for (WaitSetSet::iterator it = local_ws.begin(), end = local_ws.end();
00038        it != end; ++it) {
00039     (*it)->signal(this);
00040   }
00041 }


Member Data Documentation

ACE_Recursive_Thread_Mutex OpenDDS::DCPS::ConditionImpl::lock_ [protected]

Reimplemented in OpenDDS::DCPS::QueryConditionImpl.

Definition at line 38 of file ConditionImpl.h.

Referenced by attach_to_ws(), detach_from_ws(), OpenDDS::DCPS::StatusConditionImpl::get_enabled_statuses(), OpenDDS::DCPS::StatusConditionImpl::get_trigger_value(), OpenDDS::DCPS::StatusConditionImpl::set_enabled_statuses(), and signal_all().

WaitSetSet OpenDDS::DCPS::ConditionImpl::waitsets_ [protected]

Definition at line 37 of file ConditionImpl.h.

Referenced by attach_to_ws(), detach_from_ws(), and signal_all().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:11 2016 for OpenDDS by  doxygen 1.4.7