RTI Connext Micro  Version 2.4.1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
dds_c_rh_plugin.h
Go to the documentation of this file.
1 /*
2  * FILE: dds_c_rh_plugin.h - DDS reader history interface
3  *
4  * (c) Copyright, Real-Time Innovations, 2011-2014.
5  *
6  * All rights reserved.
7  *
8  * No duplications, whole or partial, manual or electronic, may be made
9  * without express written permission. Any such copies, or
10  * revisions thereof, must display this notice unaltered.
11  * This code contains trade secrets of Real-Time Innovations, Inc.
12  *
13  * Modification History
14  * --------------------
15  * 08oct2014,tk MICRO-919 Added SampleLostReason to SampleLost status
16  * 16aug2011,tk Written
17  */
18 /*ce
19  * \file
20  * \brief DDS reader history interface
21  */
22 /*ci \defgroup DDSHistoryModule DDS History module
23  * \ingroup DDSCModule
24  */
25 /*ci \defgroup DDSReaderHistoryModule DDS Reader History module
26  * \ingroup DDSHistoryModule
27  */
28 /*ci \addtogroup DDSReaderHistoryModule
29  * @{
30  */
31 #ifndef dds_c_rh_plugin_h
32 #define dds_c_rh_plugin_h
33 
34 
35 #ifndef dds_c_dll_h
36 #include "dds_c/dds_c_dll.h"
37 #endif
38 #ifndef dds_c_discovery_h
39 #include "dds_c/dds_c_discovery.h"
40 #endif
41 
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 
47 /*ci
48  * \brief Enumeration of supported reader history events
49  */
50 typedef enum
51 {
52  /*ci
53  * \brief Liveliness was lost on a remote writer
54  */
55  DDSHST_READEREVENT_KIND_LIVELINESS_LOST = 1,
56 
57  /*ci
58  * \brief Liveliness was detected on a remote writer
59  */
60  DDSHST_READEREVENT_KIND_LIVELINESS_DETECTED,
61 
62  /*ci
63  * \brief A remote writer was deleted
64  */
65  DDSHST_READEREVENT_KIND_REMOTE_WRITER_DELETED,
66 
67  /*ci
68  * \brief The deadline timer expired, check deadlines
69  */
70  DDSHST_READEREVENT_KIND_DEADLINE_EXPIRED
71 } DDSHST_ReaderEventKind_T;
72 
73 /*ci
74  * \brief A reader history event that can be posted to the cache
75  */
76 struct DDSHST_ReaderEvent
77 {
78  /*ci
79  * \brief The event type
80  */
81  DDSHST_ReaderEventKind_T kind;
82 
83  /*ci
84  * \brief event data based on the kind
85  */
86  union
87  {
88  /*ci
89  * \brief Event data asscociated with liveliness loss/detection
90  */
91  struct
92  {
93  /*ci
94  * \brief Remote writer key liveliness changed on
95  */
96  DDS_InstanceHandle_t rw_guid;
97 
98  /*ci
99  * \brief The key for the instance that changed liveliness
100  */
101  DDS_InstanceHandle_t instance;
102  } liveliness;
103 
104  /*ci
105  * \brief Event data associated with remote writer deletion
106  */
107  struct
108  {
109  /*ci
110  * \brief The GUID of the deleteted remote writer
111  */
112  DDS_InstanceHandle_t rw_guid;
113  } rw_deleted;
114  } data;
115 };
116 
117 /*ci
118  * \brief Base-class for reader history cache
119  */
120 struct DDSHST_Reader
121 {
122  /*ci
123  * \brief Inherit from base-class
124  */
125  struct RT_Component _parent;
126 };
127 
128 typedef struct DDSHST_Reader DDSHST_Reader_T;
129 
130 struct DDSHST_ReaderSampleEntry;
131 
132 /*ci
133  * \brief Implementation independent reference to a sample in the
134  * reader history cache
135  */
136 typedef struct DDSHST_ReaderSampleEntry* DDSHST_ReaderSampleEntryRef_T;
137 
138 struct DDSHST_ReaderKeyEntry;
139 
140 /*ci
141  * \brief Implementation independent reference to a key in the
142  * reader history cache
143  */
144 typedef struct DDSHST_ReaderKeyEntry* DDSHST_ReaderKeyEntryRef_T;
145 
146 /*ci
147  * \brief Implementation independent reader cache sample
148  */
149 typedef struct DDSHST_ReaderSample
150 {
151  /*ci
152  * \brief Payload data, opaque to the cache and managed outside the cache,
153  * may by NULL for meta-samples
154  */
155  void *_user_data;
156 
157  /*ci
158  * \brief Pointer to inline parameters for this sample, managed outside the
159  * cache
160  */
161  void *_param;
162 
163  /*ci
164  * \brief Pointer meta information about the sample, memory owner by
165  * history implementation
166  */
167  struct DDS_SampleInfo *_info;
168 
169  /*ci
170  * \brief Status information related to the sample, such as disposed
171  */
172  DDS_UnsignedLong status_info;
173 
174  /*ci
175  * \brief Reference to the corresponding entry in the implementation specific
176  * cache
177  */
178  DDSHST_ReaderSampleEntryRef_T _ref;
179 } DDSHST_ReaderSample_T;
180 
181 DDS_SEQUENCE(DDSHST_ReaderSample_TSeq, DDSHST_ReaderSample_T)
182 
183 /*ci
184  * \brief Base-class properties for the DDS reader history cache
185  */
186 struct DDSHST_ReaderProperty
187 {
188  /*ci
189  * \brief Inherit from a component
190  */
191  struct RT_ComponentProperty _parent;
192 
193  /*ci
194  * \brief Pointer to the qos policy for the DDS reader that uses the history
195  * cache
196  */
197  struct DDS_DataReaderQos *qos;
198 
199  /*ci
200  * \brief Timer to use if timeouts are needed
201  */
202  OSAPI_Timer_T timer;
203 };
204 
205 /*ci
206  * \def DDSHST_ReaderProperty_INITIALIZER
207  * \brief Constant to initialize \ref DDSHST_ReaderProperty
208  */
209 #define DDSHST_ReaderProperty_INITIALIZER \
210 {\
211  RT_ComponentProperty_INITIALIZER,\
212  NULL,\
213  NULL \
214 }
215 
216 /*ci
217  * \brief Definition of the \ref DDSHST_ReaderListener on_sample_removed callback
218  *
219  * \details
220  * When the history cache removes a sample it calls this listener if it is
221  * installed.
222  *
223  * \param[in] rh The history cache
224  * \param[in] listener_data Opaque pointer to listener data
225  * \param[in] key The key the sample belonged too
226  * \param[in] sample The sample being removed
227  */
228 typedef void
229 (*DDSHST_ReaderListener_OnSampleRemovedFunc)(
230  struct DDSHST_Reader *rh,
231  void *listener_data,
233  DDSHST_ReaderSample_T *sample);
234 
235 /*ci
236  * \brief Definition of the \ref DDSHST_ReaderListener on_key_removed callback
237  *
238  * \details
239  * When the history cache removes a key it calls this listener if it is
240  * installed.
241  *
242  * \param[in] rh The history cache
243  * \param[in] listener_data Opaque pointer to listener data
244  * \param[in] key The key being removed
245  */
246 typedef void
247 (*DDSHST_ReaderListener_OnKeyRemovedFunc)(
248  struct DDSHST_Reader *rh,
249  void *listener_data,
250  DDS_InstanceHandle_t *key);
251 
252 /*ci
253  * \brief Definition of the \ref DDSHST_ReaderListener on_deadline_missed callback
254  *
255  * \details
256  * When an instance is not being updated according to the deadline the cache
257  * calls this listener if it is installed.
258  *
259  * \param[in] rh The history cache
260  * \param[in] listener_data Opaque pointer to listener data
261  * \param[in] key The key that missed its deadline
262  */
263 typedef void
264 (*DDSHST_ReaderListener_OnDeadlineMissedFunc)(
265  struct DDSHST_Reader *rh,
266  void *listener_data,
267  DDS_InstanceHandle_t *key);
268 
269 /*ci
270  * \brief Definition of the \ref DDSHST_ReaderListener on_data_available callback
271  *
272  * \details
273  * When new data is available in the history cache this listener is called
274  * if it installed.
275  *
276  * \param[in] rh The history cache
277  * \param[in] listener_data Opaque pointer to listener data
278  * \param[in] key The key data is available in
279  * \param[in] sample The new data
280  */
281 typedef void
282 (*DDSHST_ReaderListener_OnDataAvailableFunc)(
283  struct DDSHST_Reader *rh,
284  void *listener_data,
286  DDSHST_ReaderSample_T *sample);
287 
288 /*ci
289  * \brief Definition of the \ref DDSHST_ReaderListener on_sample_rejected callback
290  *
291  * \details
292  * If a sample is rejected from the history cache this listener is called
293  * if it installed.
294  *
295  * \param[in] rh The history cache
296  * \param[in] listener_data Opaque pointer to listener data
297  * \param[in] key The key that was rejected
298  * \param[in] reason The reason the sample was rejected
299  */
300 typedef void
301 (*DDSHST_ReaderListener_OnSampleRejectedFunc)(
302  struct DDSHST_Reader *rh,
303  void *listener_data,
306 
307 /*ci
308  * \brief Definition of the \ref DDSHST_ReaderListener on_sample_lost callback
309  *
310  * \details
311  * When the history cache determines a sample is permanently lost,
312  * the history cache this listener is called if it installed.
313  *
314  * \param[in] rh The history cache
315  * \param[in] listener_data Opaque pointer to listener data
316  */
317 typedef void
318 (*DDSHST_ReaderListener_OnSampleLostFunc)(
319  struct DDSHST_Reader *rh,
320  void *listener_data,
321  struct DDS_SampleInfo *sample_info,
322  DDS_SampleLostStatusKind reason);
323 
324 /*ci
325  * \brief Definition of the \ref DDSHST_ReaderListener on_instance_replaced callback
326  *
327  * \details
328  * When the history cache replaces an instance in the history cache, it calls
329  * this listener if it is installed.
330  *
331  * \param[in] rh The history cache
332  * \param[in] listener_data Opaque pointer to listener data
333  * \param[in] replaced_key The key that was replaced
334  * \param[in] replaced_by_key The new key
335  * \param[in] publisher The publisher publishing the replacement key
336  * \param[in] min_removed_samples Minimum number of samples removed due to a
337  * key being replaced.
338  */
339 typedef void
340 (*DDSHST_ReaderListener_OnInstanceReplacedFunc)(
341  struct DDSHST_Reader *rh,
342  void *listener_data,
343  DDS_InstanceHandle_t *replaced_key,
344  DDS_InstanceHandle_t *replaced_by_key,
345  DDS_InstanceHandle_t *publisher,
346  DDS_Long min_removed_samples);
347 
348 /*ci
349  * \brief Base-class for DDS Reader history listener
350  */
351 struct DDSHST_ReaderListener
352 {
353  /*ci
354  * \brief Inherit from parent class
355  */
356  struct RT_ComponentListener _parent;
357 
358  /*ci
359  * \brief Called when the cache removed a sample
360  */
361  DDSHST_ReaderListener_OnSampleRemovedFunc on_sample_removed;
362 
363  /*ci
364  * \brief Called when the cache removed a key
365  */
366  DDSHST_ReaderListener_OnKeyRemovedFunc on_key_removed;
367 
368  /*ci
369  * \brief Called when the cache when new data is available in the cache
370  */
371  DDSHST_ReaderListener_OnDataAvailableFunc on_data_available;
372 
373  /*ci
374  * \brief Called when the cache detected deadline missed on an instance
375  */
376  DDSHST_ReaderListener_OnDeadlineMissedFunc on_deadline_missed;
377 
378  /*ci
379  * \brief Called when the cache rejected a sample
380  */
381  DDSHST_ReaderListener_OnSampleRejectedFunc on_sample_rejected;
382 
383  /*ci
384  * \brief Called when the cache detected loss of samples
385  */
386  DDSHST_ReaderListener_OnSampleLostFunc on_sample_lost;
387 
388  /*ci
389  * \brief Called when the cache forcefully replaced an instance
390  */
391  DDSHST_ReaderListener_OnInstanceReplacedFunc on_instance_replaced;
392 
393  /*ci
394  * \brief Opaque listener data passed back to listener functions
395  */
396  void *listener_data;
397 };
398 
399 /*ci
400  * \brief Constant to initialize \ref DDSHST_ReaderListener
401  */
402 #define DDSHST_ReaderListener_INITIALIZE {\
403  RT_ComponentListener_INITIALIZER,\
404  NULL,\
405  NULL,\
406  NULL,\
407  NULL,\
408  NULL,\
409  NULL,\
410  NULL,\
411  NULL\
412 }
413 
414 /* ------------------------------ Life-cycle -------------------------------- */
415 /*ci
416  * \brief Definition of \ref RT_ComponentFactory delete_component method
417  *
418  * \param[in] self The reader history instance to delete
419  *
420  * \sa \ref RT_ComponentFactoryI
421  */
422 typedef void
423 (*DDSHST_Reader_deleteFunc)(struct DDSHST_Reader * self);
424 
425 /*ci
426  * \brief Definition of \ref RT_ComponentFactory create_component method
427  *
428  * \param[in] property The component property
429  * \param[in] listener The component listener
430  *
431  * \return A reference to a new reader cache on success, NULL otherwise
432  *
433  * \sa \ref RT_ComponentFactoryI
434  */
435 FUNCTION_MUST_TYPEDEF(
436 struct DDSHST_Reader*
437 (*DDSHST_Reader_createFunc)(
438  const struct DDSHST_ReaderProperty *const property,
439  const struct DDSHST_ReaderListener *const listener)
440 )
441 
442 /* ------------------------------ Methods ----------------------------------- */
443 /*ci
444  * \brief Definition of the \ref DDSHST_ReaderI reserve_entry method
445  *
446  * \param[in] rh The history cache
447  * \param[in] rw The remote writer the reservation is for
448  * \param[in] key The key the reservation is for
449  * \param[out] sample_info A pointer to a sample info structure for this
450  * sample, memory owned by the queue
451  * \param[in] strength The current strength for the remote writer the
452  * reservation for
453  * \param[in] sample_sn The SN for this entry
454  * \param[out] reject_reason If the reservation failed, this is the reason
455  *
456  * \return A reference to a reservation, NULL otherwise
457  *
458  * \sa \ref DDSHST_Reader_reserve_entry, \ref DDSHST_ReaderI
459  */
460 FUNCTION_MUST_TYPEDEF(
461 DDSHST_ReaderSampleEntryRef_T
462 (*DDSHST_Reader_reserve_entryFunc)(
463  struct DDSHST_Reader *self,
466  struct DDS_SampleInfo **sample_info,
467  DDS_Long strength,
468  struct REDA_SequenceNumber *sample_sn,
469  DDS_SampleRejectedStatusKind *reject_reason)
470 )
471 
472 /*ci
473  * \brief Definition of the \ref DDSHST_ReaderI return_entry method
474  *
475  * \param[in] rh self
476  * \param[in] entry reservation to cancel
477  *
478  * \sa \ref DDSHST_Reader_return_entry, \ref DDSHST_ReaderI
479  */
480 typedef void
481 (*DDSHST_Reader_return_entryFunc)(
482  struct DDSHST_Reader *self,
483  DDSHST_ReaderSampleEntryRef_T entry);
484 
485 /*ci
486  * \brief Definition of the \ref DDSHST_ReaderI commit method
487  *
488  * \param[in] self The history cache
489  * \param[in] rw The remote writer to commit samples for
490  * \param[in] sn The first non committable sequence number
491  * \param[in] strength The strength of the writer
492  *
493  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
494  * \ref DDSHST_ReturnCode_T on failure
495  *
496  * \sa \ref DDSHST_Reader_commit, \ref DDSHST_ReaderI
497  */
498 FUNCTION_MUST_TYPEDEF(
499 DDSHST_ReturnCode_T
500 (*DDSHST_Reader_commitFunc)(
501  struct DDSHST_Reader *self,
503  struct REDA_SequenceNumber *sn,
504  DDS_Long strength)
505 )
506 
507 /*ci
508  * \brief Definition of the \ref DDSHST_ReaderI add_and_commit method
509  *
510  * \param[in] rh The history cache
511  * \param[in] entry The reserved entry to commit
512  * \param[in] sample The sample associated with the reservation
513  * \param[in] commit_sn The first non-committable sequence number
514  *
515  * \sa \ref DDSHST_Reader_add_and_commit, \ref DDSHST_ReaderI
516  */
517 FUNCTION_MUST_TYPEDEF(
518 DDSHST_ReturnCode_T
519 (*DDSHST_Reader_add_and_commitFunc)(
520  struct DDSHST_Reader *rh,
521  DDSHST_ReaderSampleEntryRef_T entry,
522  DDSHST_ReaderSample_T *sample,
523  struct REDA_SequenceNumber *commit_sn)
524 )
525 
526 /*ci
527  * \brief Definition of the \ref DDSHST_ReaderI post_event method
528  *
529  * \param[in] self The history cache
530  * \param[in] event The event that occurred
531  * \param[in] now The time the event occurred
532  *
533  * \sa \ref DDSHST_Reader_post_event, \ref DDSHST_ReaderI
534  */
535 typedef void
536 (*DDSHST_Reader_post_eventFunc)(
537  struct DDSHST_Reader *self,
538  struct DDSHST_ReaderEvent *event,
539  struct OSAPI_NtpTime *now);
540 
541 /*ci
542  * \brief Definition of the \ref DDSHST_ReaderI read_or_take method
543  *
544  * \param[in] self The history cache to read from
545  * \param[inout] sample_ptr_array A sequence of pointers to samples
546  * \param[inout] info_array A sequence of pointers to sample info
547  * \param[in] sample_count The actual number of samples returned
548  * \param[in] a_handle The instance to return (NIL is any instance)
549  * \param[in] max_samples The max number of samples to return (including
550  * the meta sample)
551  * \param[in] sample_states The requested sample state
552  * \param[in] view_states The requested view state
553  * \param[in] instance_states The requested instance state
554  * \param[in] take Whether this removes (RTI_TRUE) or leaves
555  * samples in the cache (RTI_FALSE)
556  *
557  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
558  * \ref DDSHST_ReturnCode_T on failure
559  *
560  * \sa \ref DDSHST_Reader_read_or_take, \ref DDSHST_ReaderI
561  */
562 FUNCTION_MUST_TYPEDEF(
564 (*DDSHST_Reader_read_or_takeFunc)(
565  struct DDSHST_Reader *self,
566  void ***sample_ptr_array,
567  struct DDS_SampleInfo **info_array,
568  DDS_Long *sample_count,
569  const DDS_InstanceHandle_t *a_handle,
570  DDS_Long max_samples,
571  DDS_SampleStateMask sample_states,
572  DDS_ViewStateMask view_states,
573  DDS_InstanceStateMask instance_states,
574  DDS_Boolean take)
575 )
576 
577 /*ci
578  * \brief Definition of the \ref DDSHST_ReaderI finish_read_or_take method
579  *
580  * \param[in] self The history cache to return the sequences to
581  * \param[in] sample_ptr_array A sequence of pointers to samples to return
582  * \param[in] info_array A sequence of pointers to sample info to return
583  * \param[in] sample_count The number of samples to return in each sequence
584  * \param[in] taken Whether the samples where taken or not
585  *
586  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
587  * \ref DDSHST_ReturnCode_T on failure
588  *
589  * \sa \ref DDSHST_Reader_finish_read_or_take, \ref DDSHST_ReaderI
590  */
591 FUNCTION_MUST_TYPEDEF(
593 (*DDSHST_Reader_finish_read_or_takeFunc)(
594  struct DDSHST_Reader *self,
595  void ***sample_ptr_array,
596  struct DDS_SampleInfo **info_array,
597  DDS_Long sample_count,
598  DDS_Boolean taken)
599 )
600 
601 /*ci
602  * \brief Definition of the \ref DDSHST_ReaderI lookup_key method
603  *
604  * \param[in] self The history cache
605  * \param[in] key The key entry to search for
606  *
607  * \return A key entry on success, NULL if the entry was not found
608  *
609  * \sa \ref DDSHST_Reader_lookup_key, \ref DDSHST_ReaderI
610  */
611 FUNCTION_MUST_TYPEDEF(
612 DDSHST_ReaderKeyEntryRef_T
613 (*DDSHST_Reader_lookup_keyFunc)(struct DDSHST_Reader* self,
614  const DDS_InstanceHandle_t *const key)
615 )
616 
617 /*ci
618  * \brief Definition of the DDSHST_Reader history interface
619  */
620 struct DDSHST_ReaderI
621 {
622  /*ci
623  * \brief The base-class listener
624  */
625  struct RT_ComponentI _parent;
626 
627  /*ci
628  * \brief Method to return an entry to the cache
629  */
630  DDSHST_Reader_return_entryFunc return_entry;
631 
632  /*ci
633  * \brief Method to read or take an entry from the cache
634  */
635  DDSHST_Reader_read_or_takeFunc read_or_take;
636 
637  /*ci
638  * \brief Method to return a loan to the cache
639  */
640  DDSHST_Reader_finish_read_or_takeFunc finish_read_or_take;
641 
642  /*ci
643  * \brief Method to post an event to the cache
644  */
645  DDSHST_Reader_post_eventFunc post_event;
646 
647  /*ci
648  * \brief Method to lookup the key from the cache
649  */
650  DDSHST_Reader_lookup_keyFunc lookup_key;
651 
652  /*ci
653  * \brief Method to reserve a spot in the cache
654  */
655  DDSHST_Reader_reserve_entryFunc reserve_entry;
656 
657  /*ci
658  * \brief Method to add a reservation to the cache and commit the
659  * entries
660  */
661  DDSHST_Reader_add_and_commitFunc add_and_commit;
662 
663  /*ci
664  * \brief Method to commit existing entries in the cac (if possible)
665  */
666  DDSHST_Reader_commitFunc commit;
667 };
668 
669 /*ci
670  * \brief Create a new instance of the reader history cache
671  */
672 #define DDSHST_ReaderFactory_create_component(f_,p_,l_) \
673 (struct DDSHST_Reader*)((f_)->intf)->create_component(f_,p_,l_)
674 
675 /*ci
676  * \brief Delete an instance of the reader history cache
677  */
678 #define DDSHST_ReaderFactory_delete_component(f_,c_) \
679  ((f_)->intf)->delete_component(f_,(RT_Component_T*)(c_))
680 
681 /*ci
682  * \brief Implementation of the DDSHST_Reader_reserve_entry function
683  *
684  * \details
685  * This function tries to reserve an entry in the cache based on the current
686  * resource limits. A reserved entry can either be committed to the queue
687  * or returned unused (cancelled). If an entry is returned (not called decided
688  * to not use it), all operations that took place in the reservation are
689  * reversed. That is, any resource allocated are freed.
690  *
691  * \param[in] self_ The history cache
692  * \param[in] rw_ The remote writer the reservation is for
693  * \param[in] key_ The key the reservation is for
694  * \param[out] si_ A pointer to a sample info structure for this
695  * sample, memory owned by the queue
696  * \param[in] strength_ The current strength for the remote writer the
697  * reservation for
698  * \param[in] sample_sn_ The SN for this entry
699  * \param[out] reject_reason_ If the reservation failed, this is the reason
700  *
701  * \return A reference to a reservation, NULL otherwise
702  */
703 #define DDSHST_Reader_reserve_entry(self_,rw_,key_,si_,strength_,\
704  sample_sn_,reject_reason_) \
705  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->reserve_entry(\
706  self_,rw_,key_,si_,strength_,\
707  sample_sn_,reject_reason_)
708 /*ci
709  * \brief Return/Cancel a queue reservation
710  *
711  * \details
712  *
713  * Return a previous reservation. Returning a reservation has no effect
714  * on the queue, and any resources allocated are returned.
715  *
716  * \param[in] self_ self
717  * \param[in] entry_ reservation to cancel
718  *
719  * \sa \ref RHSM_History_reserve_entry
720  */
721 #define DDSHST_Reader_return_entry(self_,entry_) \
722  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->return_entry(\
723  self_,entry_)
724 
725 /*ci
726  * \brief Add a reserved sample to the queue and commit one or more
727  *
728  * \details
729  * When a reservation is made the entry does not exist in the cache, only
730  * a sample to fill in exists. If the holder of the reservation decides to
731  * keep the sample it must be added. When a new sample is added it may also
732  * result in 1 or more samples being committed (for example if the newly
733  * added sample complete a sequence of samples).
734  *
735  * \param[in] self_ The history cache
736  * \param[in] entry_ The reserved entry to commit
737  * \param[in] sample_ The sample associated with the reservation
738  * \param[in] sn_ The first non-committable sequence number
739  *
740  * \sa \ref RHSM_History_reserve_entry
741  */
742 #define DDSHST_Reader_add_and_commit(self_,entry_,sample_,sn_) \
743  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->add_and_commit(\
744  self_,entry_,sample_,sn_)
745 
746 /*ci
747  * \brief Commit all cached samples up to a specific SN for a remote writer
748  *
749  * \details
750  * The history cache may stores samples received out of order to improve
751  * performance for reliable communication. If samples are received out of
752  * order there may be a backlog of samples until a sample is received that
753  * completes a sequence of samples. This function adds all these samples
754  * to the ordered list of samples.
755  *
756  * \param[in] self_ The history cache
757  * \param[in] rw_ The remote writer to commit samples for
758  * \param[in] sn_ The first non commitable sequence number
759  * \param[in] s_ The strength of the writer
760  *
761  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
762  * \ref DDSHST_ReturnCode_T on failure
763  */
764 #define DDSHST_Reader_commit(self_,rw_,sn_,s_) \
765  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->commit(\
766  self_,rw_,sn_,s_)
767 
768 /*
769  * \brief Read or take 1 or more samples matching a particular state from the
770  * history cache
771  *
772  * \details
773  * Return 0 or more samples and sample info. The sample_ptr_array and
774  * info_array must be pre-allocated to hold at least max_samples
775  * pointers. Note that the history _always_ operates on pointer to samples,
776  * it has no knowledge about types.
777  *
778  * \param[in] self_ The history cache to read from
779  * \param[inout] sample_arr_ A sequence of pointers to samples
780  * \param[inout] info_arr_ A sequence of pointers to sample info
781  * \param[in] count_ The actual number of samples returned
782  * \param[in] handle_ The instance to return (NIL is any instance)
783  * \param[in] max_samples_ The max number of samples to return (including
784  * the meta sample)
785  * \param[in] sample_states_ The requested sample state
786  * \param[in] view_states_ The requested view state
787  * \param[in] instance_states_ The requested instance state
788  * \param[in] take_ Whether this removes (RTI_TRUE) or leaves
789  * samples in the cache (RTI_FALSE)
790  *
791  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
792  * \ref DDSHST_ReturnCode_T on failure
793  */
794 #define DDSHST_Reader_read_or_take(self_,\
795  sample_arr_,info_arr_,count_,handle_,max_samples_,sample_states_,view_states_,\
796  instance_states_,take_) \
797  ((struct DDSHST_ReaderI*)(\
798  (self_)->_parent._intf))->read_or_take(self_,\
799  sample_arr_,info_arr_,count_,handle_,max_samples_,\
800  sample_states_,view_states_,instance_states_,take_)
801 
802 /*ci
803  * \brief Return a loan after calling \ref RHSM_History_read_or_take
804  *
805  * \param[in] self_ The history cache to return the sequences to
806  * \param[in] sample_seq_ A sequence of pointers to samples to return
807  * \param[in] info_seq_ A sequence of pointers to sample info to return
808  * \param[in] count_ The number of samples to return in each sequence
809  * \param[in] take_ Whether the samples where taken or not
810  *
811  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
812  * \ref DDSHST_ReturnCode_T on failure
813  *
814  * \sa \ref RHSM_History_read_or_take
815  */
816 #define DDSHST_Reader_finish_read_or_take(self_,sample_seq_,info_seq_,count_,take_) \
817  ((struct DDSHST_ReaderI*)(\
818  (self_)->_parent._intf))->finish_read_or_take(self_,\
819  sample_seq_,info_seq_,count_,take_)
820 
821 /*ci
822  * \brief Post an external event to the history cache
823  *
824  * \details
825  * This function is the entry point to signal the queue for various
826  * types of external events.
827  *
828  * \param[in] self_ The history cache
829  * \param[in] event_ The event that occurred
830  * \param[in] time_ The time the event occurred
831  */
832 #define DDSHST_Reader_post_event(self_,event_,time_) \
833  ((struct DDSHST_ReaderI*)(\
834  (self_)->_parent._intf))->post_event(self_,event_,time_)
835 
836 /*ci
837  * \brief Find and return a pointer to a key entry based on the instance handle
838  *
839  * \param[in] self_ The history cache
840  * \param[in] key_ The key entry to search for
841  *
842  * \return A key entry on success, NULL if the entry was not found
843  */
844 #define DDSHST_Reader_lookup_key(self_,key_) \
845  ((struct DDSHST_ReaderI*)(\
846  (self_)->_parent._intf))->lookup_key(self_,key_)
847 
848 #ifdef __cplusplus
849 } /* extern "C" */
850 #endif
851 
852 #endif /* dds_c_rh_plugin_h */
853 
854 /*ci @} */

RTI Connext Micro Version 2.4.1.0 Copyright © Thu Nov 20 2014 Real-Time Innovations, Inc