EntityImpl.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_ENTITY_IMPL_H
00009 #define OPENDDS_DCPS_ENTITY_IMPL_H
00010 
00011 #include "dds/DdsDcpsInfrastructureC.h"
00012 #include "ace/Atomic_Op_T.h"
00013 #include "dds/DCPS/LocalObject.h"
00014 #include "Definitions.h"
00015 #include "dds/DCPS/transport/framework/TransportConfig_rch.h"
00016 
00017 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00018 #pragma once
00019 #endif /* ACE_LACKS_PRAGMA_ONCE */
00020 
00021 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00022 
00023 namespace OpenDDS {
00024 namespace DCPS {
00025 
00026 /**
00027 * @class EntityImpl
00028 *
00029 * @brief Implements the OpenDDS::DCPS::Entity
00030 *        interfaces.
00031 *
00032 * This class is the base class of other servant classes.
00033 * e.g. DomainParticipantImpl, PublisherImpl ...
00034 */
00035 class OpenDDS_Dcps_Export EntityImpl
00036   : public virtual LocalObject<DDS::Entity> {
00037 public:
00038   EntityImpl();
00039 
00040   virtual ~EntityImpl();
00041 
00042   bool is_enabled() const;
00043 
00044   virtual DDS::StatusCondition_ptr get_statuscondition();
00045 
00046   virtual DDS::StatusMask get_status_changes();
00047 
00048   virtual DDS::InstanceHandle_t get_instance_handle() = 0;
00049 
00050   void set_status_changed_flag(DDS::StatusKind status,
00051                                bool status_changed_flag);
00052 
00053   /// Call this *after* dispatching to listeners when the "changed status
00054   /// flag" is enabled so that any waiting waitsets can be unblocked.
00055   void notify_status_condition();
00056 
00057   virtual void transport_config(const TransportConfig_rch& cfg);
00058   TransportConfig_rch transport_config() const;
00059 
00060   virtual RcHandle<EntityImpl> parent() const { return RcHandle<EntityImpl>(); }
00061 
00062 protected:
00063   DDS::ReturnCode_t set_enabled();
00064 
00065   void set_deleted(bool state);
00066 
00067   bool get_deleted();
00068 
00069   /// The flag indicates the entity is enabled.
00070   ACE_Atomic_Op<TAO_SYNCH_MUTEX, bool>       enabled_;
00071 
00072   /// The flag indicates the entity is being deleted.
00073   ACE_Atomic_Op<TAO_SYNCH_MUTEX, bool>       entity_deleted_;
00074 
00075 private:
00076   /// The status_changes_ variable lists all status changed flag.
00077   /// The StatusChangedFlag becomes TRUE whenever the plain communication
00078   /// status changes and it is reset to FALSE each time the application
00079   /// accesses the plain communication status via the proper
00080   /// get_<plain communication status> operation on the Entity.
00081   DDS::StatusMask status_changes_;
00082   DDS::StatusCondition_var status_condition_;
00083 
00084   TransportConfig_rch transport_config_;
00085 
00086   mutable ACE_Thread_Mutex lock_;
00087 };
00088 
00089 } // namespace DCPS
00090 } // namespace OpenDDS
00091 
00092 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00093 
00094 #endif /* OPENDDS_DCPS_ENTITY_IMPL_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1