EntityImpl.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  * Distributed under the OpenDDS License.
00004  * See: http://www.opendds.org/license.html
00005  */
00006 
00007 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
00008 #include "EntityImpl.h"
00009 #include "StatusConditionImpl.h"
00010 #include "dds/DCPS/transport/framework/TransportConfig.h"
00011 
00012 namespace OpenDDS {
00013 namespace DCPS {
00014 
00015 // Implementation skeleton constructor
00016 EntityImpl::EntityImpl()
00017   : enabled_(false),
00018     entity_deleted_(false),
00019     status_changes_(0),
00020     status_condition_(new StatusConditionImpl(this))
00021 {
00022 }
00023 
00024 // Implementation skeleton destructor
00025 EntityImpl::~EntityImpl()
00026 {
00027 }
00028 
00029 DDS::ReturnCode_t
00030 EntityImpl::set_enabled()
00031 {
00032   if (enabled_ == false) {
00033     enabled_ = true;
00034   }
00035 
00036   return DDS::RETCODE_OK;
00037 }
00038 
00039 bool
00040 EntityImpl::is_enabled() const
00041 {
00042   return this->enabled_.value();
00043 }
00044 
00045 DDS::StatusCondition_ptr
00046 EntityImpl::get_statuscondition()
00047 {
00048   return DDS::StatusCondition::_duplicate(status_condition_);
00049 }
00050 
00051 DDS::StatusMask
00052 EntityImpl::get_status_changes()
00053 {
00054   ACE_GUARD_RETURN(ACE_Thread_Mutex, g, lock_, 0);
00055   return status_changes_;
00056 }
00057 
00058 void
00059 EntityImpl::set_status_changed_flag(
00060   DDS::StatusKind status,
00061   bool status_changed_flag)
00062 {
00063   ACE_GUARD(ACE_Thread_Mutex, g, lock_);
00064 
00065   if (status_changed_flag) {
00066     status_changes_ |= status;
00067 
00068   } else {
00069     status_changes_ &= ~status;
00070   }
00071 }
00072 
00073 void
00074 EntityImpl::set_deleted(bool state)
00075 {
00076   if (entity_deleted_ != state) {
00077     entity_deleted_ = state;
00078   }
00079 }
00080 
00081 bool
00082 EntityImpl::get_deleted()
00083 {
00084   bool deleted_state = true;
00085 
00086   if (entity_deleted_ != true) {
00087     deleted_state = false;
00088   }
00089 
00090   return deleted_state;
00091 }
00092 
00093 void
00094 EntityImpl::notify_status_condition()
00095 {
00096   dynamic_cast<StatusConditionImpl*>(status_condition_.in())->signal_all();
00097 }
00098 
00099 void
00100 EntityImpl::transport_config(const TransportConfig_rch& cfg)
00101 {
00102   ACE_GUARD(ACE_Thread_Mutex, g, lock_);
00103   transport_config_ = cfg;
00104 }
00105 
00106 TransportConfig_rch
00107 EntityImpl::transport_config() const
00108 {
00109   ACE_GUARD_RETURN(ACE_Thread_Mutex, g, lock_, TransportConfig_rch());
00110   return transport_config_;
00111 }
00112 
00113 } // namespace DCPS
00114 } // namespace OpenDDS

Generated on Fri Feb 12 20:05:23 2016 for OpenDDS by  doxygen 1.4.7