summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/impl/ndds/WaitSet.h
blob: a2c88a0abdc61f6670675e60079cc0fde025f516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
 * @author Marcel Smit (msmit@remedy.nl)
 *
 * $Id$
 *
 * Wrapper facade for NDDS.
 */

#ifndef WAITSET_H_
#define WAITSET_H_

#include "dds4ccm/idl/ndds/ndds_dcpsC.h"
#include "tao/LocalObject.h"

#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h"

class DDSWaitSet;
struct DDSConditionSeq;

namespace CIAO
{
  namespace NDDS
  {
    /**
      * @class DDS_WaitSet_i
      *
      * @brief Representative (proxy) class for the RTI waitset.
      *
      * Implementation of the RTI waitset functionality.
      */
    class DDS4CCM_NDDS_Export DDS_WaitSet_i :
      public virtual ::DDS::WaitSet,
      public virtual ::CORBA::LocalObject
    {

    public:
      /// Constructor
      DDS_WaitSet_i ();

      /// Destructor
      virtual ~DDS_WaitSet_i (void);

      /**
        * Waits for DDS until the attached read/query conditions are met
        * or when a timeout occurs.
        *
        * active_conditions will contain conditions DDS has found.
        */
      virtual ::DDS::ReturnCode_t
      wait (::DDS::ConditionSeq & active_conditions,
            const ::DDS::Duration_t & timeout);

      /**
        * Attaches a condition to the waitset. 'wait' will be waiting for
        * this condition.
        */
      virtual ::DDS::ReturnCode_t
      attach_condition (::DDS::Condition_ptr cond);

      /**
        * Detaches a condition from the waitset. 'wait' won't be waiting
        * for this condition anymore.
        */
      virtual ::DDS::ReturnCode_t
      detach_condition (::DDS::Condition_ptr cond);

      /**
        * Retrieves a list of attached conditions.
        */
      virtual ::DDS::ReturnCode_t
      get_conditions (::DDS::ConditionSeq & attached_conditions);

      /**
        * Returns the RTI waitset
        */
      DDSWaitSet * get_rti_entity (void);

      /**
        * Used in the Reader in order to check whether whether the
        * user has supplied the correct handle with the type specific
        * instance. See Reader_T::read_one_last and the DDS4CCM spec
        * for more info.
        *
        * Checks whether two DDS-handles are equal. If no error
        * occurs and the lookup_handle exists, this method will return
        * the lookup_handle.
        *
        * @todp We actually want this method to be in the DDS4CCM
        * connector but since we're not allowed to use RTI specific code
        * there it's located here.
        *
        * 'error' will be true if instance_handle != DDS_HANDLE_NIL and
        * when instance_handle != lookup_handle.
        *
        * non_existent will be true is lookup_hnd is DDS_HANDLE_NIL
        */
      ::DDS::InstanceHandle_t
      check_handle (const ::DDS::InstanceHandle_t & instance_handle,
                    const ::DDS::InstanceHandle_t & lookup_handle,
                    bool & error,
                    bool & non_existent);

      /**
        * Creates the RTI waitset.
        */
      void init (void);

    private:
      DDSWaitSet * rti_entity_;

      DDSWaitSet * rti_entity ();

      /**
        * Converts the RTI condition(s) to the DDS4CCM condition(s)
        */
      void
      convert_conditions (const DDSConditionSeq& dds_conditions,
                          ::DDS::ConditionSeq & conditions);
    };
  }
}

#endif /* WAITSET_H_ */