Working with entities.  
More...
Working with entities. 
Enabling an entity
- To enable an DDS::Entity 
            try {                 entity.enable();             } catch (DDS.Exception) {                 Console.WriteLine("***Error: failed to enable entity");             } 
 
Checking if a status changed on an entity.
- Given an DDS::Entity and a ::DDS::StatusKind to check for, get the list of statuses that have changed since the last time they were respectively cleared. 
            StatusMask status_changes_mask = entity.get_status_changes();  
 
 
- Check if status_kindwas changed since the last time it was cleared. A plain communication status change is cleared when the status is read using the entity'sget_<plain communication status>()method. A read communication status change is cleared when the data is taken from the middleware via a TDataReader_take() call [see Changes in Status for details].
            if (((int) status_changes_mask & (int) status_kind) != 0) {                 return true;             } else {                            return false;               }          
 
Changing the QoS for an entity
The QoS for an entity can be specified at the entity creation time. Once an entity has been created, its QoS can be manipulated as follows.
- Get an entity's QoS settings using get_qos (abstract) 
            try {                 entity.get_qos(qos);             } catch (DDS.Exception) {                 Console.WriteLine("***Error: failed to get qos");             } 
 
- Change the desired qos policy fields 
- Set the qos using set_qos (abstract). 
            try {                 entity.set_qos(qos);             } catch (Retcode_ImmutablePolicy) {                 Console.WriteLine(                     "***Error: tried changing a policy that can only be" +                     "          set at entity creation time");             } catch (Retcode_InconsistentPolicy) {                 Console.WriteLine(                     "***Error: tried changing a policy to a value inconsistent" +                     "          with other policy settings");             } catch (DDS.Exception) {                 Console.WriteLine("***Error: some other failure");             } 
 
Changing the listener and enabling/disabling statuses associated with it
The listener for an entity can be specified at the entity creation time. By default the listener is enabled for all the statuses supported by the entity.
Once an entity has been created, its listener and/or the statuses for which it is enabled can be manipulated as follows.
- User defines entity listener methods 
                 public class MyEntityListener : Listener {                      }; 
 
- Get an entity's listener using Entity_get_listener 
            entity_listener = entity.get_listener();     
 
- Enable status_kindfor thelistener
            enabled_status_list |= status_kind; 
 
- Disable status_kindfor thelistener
            enabled_status_list &= ~status_kind; 
 
- Set an entity's listener to entity_listenerusing set_listener (abstract). Only enable the listener for the statuses specified by theenabled_status_list.
            try {                 entity.set_listener(entity_listener, enabled_status_list);             } catch (DDS.Exception) {                 Console.WriteLine("***Error: setting entity listener");             }     
 
Enabling/Disabling statuses associated with a status condition
Upon entity creation, by default, all the statuses are enabled for the DDS_StatusCondition associated with the entity.
Once an entity has been created, the list of statuses for which the DDS_StatusCondition is triggered can be manipulated as follows.
- Check if the given status_kindis enabled for thestatus_condition
            if (((int) enabled_status_list & (int) status_kind) != 0) {                              } else {                              } 
 
- Enable status_kindfor thestatus_condition
            try {                 statuscondition.set_enabled_statuses(                     ( StatusMask) (( int) enabled_status_list | ( int) status_kind)); 
            } catch (DDS.Exception) {                              } 
 
- Disable status_kindfor thestatus_condition
            try {                 statuscondition.set_enabled_statuses(                     ( StatusMask) (( int) enabled_status_list & ~( int) status_kind)); 
            } catch (DDS.Exception) {                              }