summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h
blob: f60d7b058a0b8f2e17b9667d9133b6b22796dda9 (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
#ifndef RG_RESETTOPIC_RECEIVER_IMPL_H_
#define RG_RESETTOPIC_RECEIVER_IMPL_H_

#include "RG_ResetTopic_ReceiverEC.h"

namespace CIAO_RG_ResetTopic_Receiver_Impl
{
  class RG_ResetTopic_Receiver_impl;

  /**
   * LastSampleChecker
   */
  class LastSampleChecker
    : public ACE_Event_Handler
  {
  public:
    LastSampleChecker (RG_ResetTopic_Receiver_impl &callback,
                       const ::CORBA::UShort &iterations);

    virtual ~LastSampleChecker (void);

    virtual int handle_timeout (const ACE_Time_Value &tv,
                                const void *arg);
  private:
    RG_ResetTopic_Receiver_impl &callback_;
    const ::CORBA::UShort iterations_;
  };

  /**
   * RG_ResetTopic_Receiver_impl
   */
  class RG_ResetTopic_Receiver_impl
  {
  public:
    RG_ResetTopic_Receiver_impl (
      ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx,
      const ::CORBA::UShort & iterations,
      const ::CORBA::UShort & keys);
    ~RG_ResetTopic_Receiver_impl (void);

    void start (const char * topic_name);
    bool check_last (void);
    void start_read (void);


    void iterations (::CORBA::UShort iterations);
    void keys (::CORBA::UShort keys);

  private:
    ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_;
    ::CORBA::UShort iterations_;
    ::CORBA::UShort keys_;
    ::CORBA::UShort expected_per_run_;

    LastSampleChecker * checker_;

    ACE_CString topic_name_;

    void set_topic_name_reader (const char * topic_name);
    void set_topic_name_getter (const char * topic_name);

    void start_reading (void);
    void start_getting (void);
    void test_exception (void);

    void check_samples (
      const char * test,
      const RG_ResetTopicSampleSeq& samples,
      const ::CORBA::UShort& expected=0);

    ACE_Reactor* reactor (void);
  };
};

#endif /* RG_RESETTOPIC_RECEIVER_IMPL_H_ */