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 namespace OpenDDS {
00022 namespace DCPS {
00023 
00024 /**
00025 * @class EntityImpl
00026 *
00027 * @brief Implements the OpenDDS::DCPS::Entity
00028 *        interfaces.
00029 *
00030 * This class is the base class of other servant classes.
00031 * e.g. DomainParticipantImpl, PublisherImpl ...
00032 */
00033 class OpenDDS_Dcps_Export EntityImpl
00034   : public virtual LocalObject<DDS::Entity> {
00035 public:
00036   ///Constructor
00037   EntityImpl();
00038 
00039   ///Destructor
00040   virtual ~EntityImpl();
00041 
00042   virtual DDS::ReturnCode_t set_enabled();
00043   bool is_enabled() const;
00044 
00045   virtual DDS::StatusCondition_ptr get_statuscondition();
00046 
00047   virtual DDS::StatusMask get_status_changes();
00048 
00049   virtual DDS::InstanceHandle_t get_instance_handle() = 0;
00050 
00051   virtual void set_deleted(bool state);
00052 
00053   virtual bool get_deleted();
00054 
00055   void set_status_changed_flag(DDS::StatusKind status,
00056                                bool status_changed_flag);
00057 
00058   /// Call this *after* dispatching to listeners when the "changed status
00059   /// flag" is enabled so that any waiting waitsets can be unblocked.
00060   void notify_status_condition();
00061 
00062   virtual void transport_config(const TransportConfig_rch& cfg);
00063   TransportConfig_rch transport_config() const;
00064 
00065   virtual EntityImpl* parent() const { return 0; }
00066 
00067 protected:
00068   /// The flag indicates the entity is enabled.
00069   ACE_Atomic_Op<TAO_SYNCH_MUTEX, bool>       enabled_;
00070 
00071   /// The flag indicates the entity is being deleted.
00072   ACE_Atomic_Op<TAO_SYNCH_MUTEX, bool>       entity_deleted_;
00073 
00074 private:
00075   /// The status_changes_ variable lists all status changed flag.
00076   /// The StatusChangedFlag becomes TRUE whenever the plain communication
00077   /// status changes and it is reset to FALSE each time the application
00078   /// accesses the plain communication status via the proper
00079   /// get_<plain communication status> operation on the Entity.
00080   DDS::StatusMask status_changes_;
00081   DDS::StatusCondition_var status_condition_;
00082 
00083   TransportConfig_rch transport_config_;
00084 
00085   mutable ACE_Thread_Mutex lock_;
00086 };
00087 
00088 } // namespace DCPS
00089 } // namespace OpenDDS
00090 
00091 #endif /* OPENDDS_DCPS_ENTITY_IMPL_H */

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