RTI Connext Micro  Version 2.4.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2015.
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 #define T DDSHST_ReaderSample_T
182 #define TSeq DDSHST_ReaderSample_TSeq
183 #include <reda/reda_sequence_decl.h>
184 
185 /*ci
186  * \brief Base-class properties for the DDS reader history cache
187  */
188 struct DDSHST_ReaderProperty
189 {
190  /*ci
191  * \brief Inherit from a component
192  */
193  struct RT_ComponentProperty _parent;
194 
195  /*ci
196  * \brief Pointer to the qos policy for the DDS reader that uses the history
197  * cache
198  */
199  struct DDS_DataReaderQos *qos;
200 
201  /*ci
202  * \brief Timer to use if timeouts are needed
203  */
204  OSAPI_Timer_T timer;
205 };
206 
207 /*ci
208  * \def DDSHST_ReaderProperty_INITIALIZER
209  * \brief Constant to initialize \ref DDSHST_ReaderProperty
210  */
211 #define DDSHST_ReaderProperty_INITIALIZER \
212 {\
213  RT_ComponentProperty_INITIALIZER,\
214  NULL,\
215  NULL \
216 }
217 
218 /*ci
219  * \brief Definition of the \ref DDSHST_ReaderListener on_sample_removed callback
220  *
221  * \details
222  * When the history cache removes a sample it calls this listener if it is
223  * installed.
224  *
225  * \param[in] rh The history cache
226  * \param[in] listener_data Opaque pointer to listener data
227  * \param[in] key The key the sample belonged too
228  * \param[in] sample The sample being removed
229  */
230 typedef void
231 (*DDSHST_ReaderListener_OnSampleRemovedFunc)(
232  struct DDSHST_Reader *rh,
233  void *listener_data,
235  DDSHST_ReaderSample_T *sample);
236 
237 /*ci
238  * \brief Definition of the \ref DDSHST_ReaderListener on_key_removed callback
239  *
240  * \details
241  * When the history cache removes a key it calls this listener if it is
242  * installed.
243  *
244  * \param[in] rh The history cache
245  * \param[in] listener_data Opaque pointer to listener data
246  * \param[in] key The key being removed
247  */
248 typedef void
249 (*DDSHST_ReaderListener_OnKeyRemovedFunc)(
250  struct DDSHST_Reader *rh,
251  void *listener_data,
252  DDS_InstanceHandle_t *key);
253 
254 /*ci
255  * \brief Definition of the \ref DDSHST_ReaderListener on_deadline_missed callback
256  *
257  * \details
258  * When an instance is not being updated according to the deadline the cache
259  * calls this listener if it is installed.
260  *
261  * \param[in] rh The history cache
262  * \param[in] listener_data Opaque pointer to listener data
263  * \param[in] key The key that missed its deadline
264  */
265 typedef void
266 (*DDSHST_ReaderListener_OnDeadlineMissedFunc)(
267  struct DDSHST_Reader *rh,
268  void *listener_data,
269  DDS_InstanceHandle_t *key);
270 
271 /*ci
272  * \brief Definition of the \ref DDSHST_ReaderListener on_data_available callback
273  *
274  * \details
275  * When new data is available in the history cache this listener is called
276  * if it installed.
277  *
278  * \param[in] rh The history cache
279  * \param[in] listener_data Opaque pointer to listener data
280  * \param[in] key The key data is available in
281  * \param[in] sample The new data
282  */
283 typedef void
284 (*DDSHST_ReaderListener_OnDataAvailableFunc)(
285  struct DDSHST_Reader *rh,
286  void *listener_data,
288  DDSHST_ReaderSample_T *sample);
289 
290 /*ci
291  * \brief Definition of the \ref DDSHST_ReaderListener on_sample_rejected callback
292  *
293  * \details
294  * If a sample is rejected from the history cache this listener is called
295  * if it installed.
296  *
297  * \param[in] rh The history cache
298  * \param[in] listener_data Opaque pointer to listener data
299  * \param[in] key The key that was rejected
300  * \param[in] reason The reason the sample was rejected
301  */
302 typedef void
303 (*DDSHST_ReaderListener_OnSampleRejectedFunc)(
304  struct DDSHST_Reader *rh,
305  void *listener_data,
308 
309 /*ci
310  * \brief Definition of the \ref DDSHST_ReaderListener on_sample_lost callback
311  *
312  * \details
313  * When the history cache determines a sample is permanently lost,
314  * the history cache this listener is called if it installed.
315  *
316  * \param[in] rh The history cache
317  * \param[in] listener_data Opaque pointer to listener data
318  */
319 typedef void
320 (*DDSHST_ReaderListener_OnSampleLostFunc)(
321  struct DDSHST_Reader *rh,
322  void *listener_data,
323  struct DDS_SampleInfo *sample_info,
324  DDS_SampleLostStatusKind reason);
325 
326 /*ci
327  * \brief Definition of the \ref DDSHST_ReaderListener on_instance_replaced callback
328  *
329  * \details
330  * When the history cache replaces an instance in the history cache, it calls
331  * this listener if it is installed.
332  *
333  * \param[in] rh The history cache
334  * \param[in] listener_data Opaque pointer to listener data
335  * \param[in] replaced_key The key that was replaced
336  * \param[in] replaced_by_key The new key
337  * \param[in] publisher The publisher publishing the replacement key
338  * \param[in] min_removed_samples Minimum number of samples removed due to a
339  * key being replaced.
340  */
341 typedef void
342 (*DDSHST_ReaderListener_OnInstanceReplacedFunc)(
343  struct DDSHST_Reader *rh,
344  void *listener_data,
345  DDS_InstanceHandle_t *replaced_key,
346  DDS_InstanceHandle_t *replaced_by_key,
347  DDS_InstanceHandle_t *publisher,
348  DDS_Long min_removed_samples);
349 
350 /*ci
351  * \brief Base-class for DDS Reader history listener
352  */
353 struct DDSHST_ReaderListener
354 {
355  /*ci
356  * \brief Inherit from parent class
357  */
358  struct RT_ComponentListener _parent;
359 
360  /*ci
361  * \brief Called when the cache removed a sample
362  */
363  DDSHST_ReaderListener_OnSampleRemovedFunc on_sample_removed;
364 
365  /*ci
366  * \brief Called when the cache removed a key
367  */
368  DDSHST_ReaderListener_OnKeyRemovedFunc on_key_removed;
369 
370  /*ci
371  * \brief Called when the cache when new data is available in the cache
372  */
373  DDSHST_ReaderListener_OnDataAvailableFunc on_data_available;
374 
375  /*ci
376  * \brief Called when the cache detected deadline missed on an instance
377  */
378  DDSHST_ReaderListener_OnDeadlineMissedFunc on_deadline_missed;
379 
380  /*ci
381  * \brief Called when the cache rejected a sample
382  */
383  DDSHST_ReaderListener_OnSampleRejectedFunc on_sample_rejected;
384 
385  /*ci
386  * \brief Called when the cache detected loss of samples
387  */
388  DDSHST_ReaderListener_OnSampleLostFunc on_sample_lost;
389 
390  /*ci
391  * \brief Called when the cache forcefully replaced an instance
392  */
393  DDSHST_ReaderListener_OnInstanceReplacedFunc on_instance_replaced;
394 
395  /*ci
396  * \brief Opaque listener data passed back to listener functions
397  */
398  void *listener_data;
399 };
400 
401 /*ci
402  * \brief Constant to initialize \ref DDSHST_ReaderListener
403  */
404 #define DDSHST_ReaderListener_INITIALIZE {\
405  RT_ComponentListener_INITIALIZER,\
406  NULL,\
407  NULL,\
408  NULL,\
409  NULL,\
410  NULL,\
411  NULL,\
412  NULL,\
413  NULL\
414 }
415 
416 /* ------------------------------ Life-cycle -------------------------------- */
417 /*ci
418  * \brief Definition of \ref RT_ComponentFactory delete_component method
419  *
420  * \param[in] self The reader history instance to delete
421  *
422  * \sa \ref RT_ComponentFactoryI
423  */
424 typedef void
425 (*DDSHST_Reader_deleteFunc)(struct DDSHST_Reader * self);
426 
427 /*ci
428  * \brief Definition of \ref RT_ComponentFactory create_component method
429  *
430  * \param[in] property The component property
431  * \param[in] listener The component listener
432  *
433  * \return A reference to a new reader cache on success, NULL otherwise
434  *
435  * \sa \ref RT_ComponentFactoryI
436  */
437 FUNCTION_MUST_TYPEDEF(
438 struct DDSHST_Reader*
439 (*DDSHST_Reader_createFunc)(
440  const struct DDSHST_ReaderProperty *const property,
441  const struct DDSHST_ReaderListener *const listener)
442 )
443 
444 /* ------------------------------ Methods ----------------------------------- */
445 /*ci
446  * \brief Definition of the \ref DDSHST_ReaderI reserve_entry method
447  *
448  * \param[in] rh The history cache
449  * \param[in] rw The remote writer the reservation is for
450  * \param[in] key The key the reservation is for
451  * \param[out] sample_info A pointer to a sample info structure for this
452  * sample, memory owned by the queue
453  * \param[in] strength The current strength for the remote writer the
454  * reservation for
455  * \param[in] sample_sn The SN for this entry
456  * \param[out] reject_reason If the reservation failed, this is the reason
457  *
458  * \return A reference to a reservation, NULL otherwise
459  *
460  * \sa \ref DDSHST_Reader_reserve_entry, \ref DDSHST_ReaderI
461  */
462 FUNCTION_MUST_TYPEDEF(
463 DDSHST_ReaderSampleEntryRef_T
464 (*DDSHST_Reader_reserve_entryFunc)(
465  struct DDSHST_Reader *self,
468  struct DDS_SampleInfo **sample_info,
469  DDS_Long strength,
470  struct REDA_SequenceNumber *sample_sn,
471  DDS_SampleRejectedStatusKind *reject_reason)
472 )
473 
474 /*ci
475  * \brief Definition of the \ref DDSHST_ReaderI return_entry method
476  *
477  * \param[in] rh self
478  * \param[in] entry reservation to cancel
479  *
480  * \sa \ref DDSHST_Reader_return_entry, \ref DDSHST_ReaderI
481  */
482 typedef void
483 (*DDSHST_Reader_return_entryFunc)(
484  struct DDSHST_Reader *self,
485  DDSHST_ReaderSampleEntryRef_T entry);
486 
487 /*ci
488  * \brief Definition of the \ref DDSHST_ReaderI commit method
489  *
490  * \param[in] self The history cache
491  * \param[in] rw The remote writer to commit samples for
492  * \param[in] sn The first non committable sequence number
493  * \param[in] strength The strength of the writer
494  *
495  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
496  * \ref DDSHST_ReturnCode_T on failure
497  *
498  * \sa \ref DDSHST_Reader_commit, \ref DDSHST_ReaderI
499  */
500 FUNCTION_MUST_TYPEDEF(
501 DDSHST_ReturnCode_T
502 (*DDSHST_Reader_commitFunc)(
503  struct DDSHST_Reader *self,
505  struct REDA_SequenceNumber *sn,
506  DDS_Long strength)
507 )
508 
509 /*ci
510  * \brief Definition of the \ref DDSHST_ReaderI add_and_commit method
511  *
512  * \param[in] rh The history cache
513  * \param[in] entry The reserved entry to commit
514  * \param[in] sample The sample associated with the reservation
515  * \param[in] commit_sn The first non-committable sequence number
516  *
517  * \sa \ref DDSHST_Reader_add_and_commit, \ref DDSHST_ReaderI
518  */
519 FUNCTION_MUST_TYPEDEF(
520 DDSHST_ReturnCode_T
521 (*DDSHST_Reader_add_and_commitFunc)(
522  struct DDSHST_Reader *rh,
523  DDSHST_ReaderSampleEntryRef_T entry,
524  DDSHST_ReaderSample_T *sample,
525  struct REDA_SequenceNumber *commit_sn)
526 )
527 
528 /*ci
529  * \brief Definition of the \ref DDSHST_ReaderI post_event method
530  *
531  * \param[in] self The history cache
532  * \param[in] event The event that occurred
533  * \param[in] now The time the event occurred
534  *
535  * \sa \ref DDSHST_Reader_post_event, \ref DDSHST_ReaderI
536  */
537 typedef void
538 (*DDSHST_Reader_post_eventFunc)(
539  struct DDSHST_Reader *self,
540  struct DDSHST_ReaderEvent *event,
541  struct OSAPI_NtpTime *now);
542 
543 /*ci
544  * \brief Definition of the \ref DDSHST_ReaderI read_or_take method
545  *
546  * \param[in] self The history cache to read from
547  * \param[inout] sample_ptr_array A sequence of pointers to samples
548  * \param[inout] info_array A sequence of pointers to sample info
549  * \param[in] sample_count The actual number of samples returned
550  * \param[in] a_handle The instance to return (NIL is any instance)
551  * \param[in] max_samples The max number of samples to return (including
552  * the meta sample)
553  * \param[in] sample_states The requested sample state
554  * \param[in] view_states The requested view state
555  * \param[in] instance_states The requested instance state
556  * \param[in] take Whether this removes (RTI_TRUE) or leaves
557  * samples in the cache (RTI_FALSE)
558  *
559  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
560  * \ref DDSHST_ReturnCode_T on failure
561  *
562  * \sa \ref DDSHST_Reader_read_or_take, \ref DDSHST_ReaderI
563  */
564 FUNCTION_MUST_TYPEDEF(
566 (*DDSHST_Reader_read_or_takeFunc)(
567  struct DDSHST_Reader *self,
568  void ***sample_ptr_array,
569  struct DDS_SampleInfo **info_array,
570  DDS_Long *sample_count,
571  const DDS_InstanceHandle_t *a_handle,
572  DDS_Long max_samples,
573  DDS_SampleStateMask sample_states,
574  DDS_ViewStateMask view_states,
575  DDS_InstanceStateMask instance_states,
576  DDS_Boolean take)
577 )
578 
579 /*ci
580  * \brief Definition of the \ref DDSHST_ReaderI finish_read_or_take method
581  *
582  * \param[in] self The history cache to return the sequences to
583  * \param[in] sample_ptr_array A sequence of pointers to samples to return
584  * \param[in] info_array A sequence of pointers to sample info to return
585  * \param[in] sample_count The number of samples to return in each sequence
586  * \param[in] taken Whether the samples where taken or not
587  *
588  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
589  * \ref DDSHST_ReturnCode_T on failure
590  *
591  * \sa \ref DDSHST_Reader_finish_read_or_take, \ref DDSHST_ReaderI
592  */
593 FUNCTION_MUST_TYPEDEF(
595 (*DDSHST_Reader_finish_read_or_takeFunc)(
596  struct DDSHST_Reader *self,
597  void ***sample_ptr_array,
598  struct DDS_SampleInfo **info_array,
599  DDS_Long sample_count,
600  DDS_Boolean taken)
601 )
602 
603 /*ci
604  * \brief Definition of the \ref DDSHST_ReaderI lookup_key method
605  *
606  * \param[in] self The history cache
607  * \param[in] key The key entry to search for
608  *
609  * \return A key entry on success, NULL if the entry was not found
610  *
611  * \sa \ref DDSHST_Reader_lookup_key, \ref DDSHST_ReaderI
612  */
613 FUNCTION_MUST_TYPEDEF(
614 DDSHST_ReaderKeyEntryRef_T
615 (*DDSHST_Reader_lookup_keyFunc)(struct DDSHST_Reader* self,
616  const DDS_InstanceHandle_t *const key)
617 )
618 
619 /*ci
620  * \brief Definition of the DDSHST_Reader history interface
621  */
622 struct DDSHST_ReaderI
623 {
624  /*ci
625  * \brief The base-class listener
626  */
627  struct RT_ComponentI _parent;
628 
629  /*ci
630  * \brief Method to return an entry to the cache
631  */
632  DDSHST_Reader_return_entryFunc return_entry;
633 
634  /*ci
635  * \brief Method to read or take an entry from the cache
636  */
637  DDSHST_Reader_read_or_takeFunc read_or_take;
638 
639  /*ci
640  * \brief Method to return a loan to the cache
641  */
642  DDSHST_Reader_finish_read_or_takeFunc finish_read_or_take;
643 
644  /*ci
645  * \brief Method to post an event to the cache
646  */
647  DDSHST_Reader_post_eventFunc post_event;
648 
649  /*ci
650  * \brief Method to lookup the key from the cache
651  */
652  DDSHST_Reader_lookup_keyFunc lookup_key;
653 
654  /*ci
655  * \brief Method to reserve a spot in the cache
656  */
657  DDSHST_Reader_reserve_entryFunc reserve_entry;
658 
659  /*ci
660  * \brief Method to add a reservation to the cache and commit the
661  * entries
662  */
663  DDSHST_Reader_add_and_commitFunc add_and_commit;
664 
665  /*ci
666  * \brief Method to commit existing entries in the cac (if possible)
667  */
668  DDSHST_Reader_commitFunc commit;
669 };
670 
671 /*ci
672  * \brief Create a new instance of the reader history cache
673  */
674 #define DDSHST_ReaderFactory_create_component(f_,p_,l_) \
675 (struct DDSHST_Reader*)((f_)->intf)->create_component(f_,p_,l_)
676 
677 /*ci
678  * \brief Delete an instance of the reader history cache
679  */
680 #define DDSHST_ReaderFactory_delete_component(f_,c_) \
681  ((f_)->intf)->delete_component(f_,(RT_Component_T*)(c_))
682 
683 /*ci
684  * \brief Implementation of the DDSHST_Reader_reserve_entry function
685  *
686  * \details
687  * This function tries to reserve an entry in the cache based on the current
688  * resource limits. A reserved entry can either be committed to the queue
689  * or returned unused (cancelled). If an entry is returned (not called decided
690  * to not use it), all operations that took place in the reservation are
691  * reversed. That is, any resource allocated are freed.
692  *
693  * \param[in] self_ The history cache
694  * \param[in] rw_ The remote writer the reservation is for
695  * \param[in] key_ The key the reservation is for
696  * \param[out] si_ A pointer to a sample info structure for this
697  * sample, memory owned by the queue
698  * \param[in] strength_ The current strength for the remote writer the
699  * reservation for
700  * \param[in] sample_sn_ The SN for this entry
701  * \param[out] reject_reason_ If the reservation failed, this is the reason
702  *
703  * \return A reference to a reservation, NULL otherwise
704  */
705 #define DDSHST_Reader_reserve_entry(self_,rw_,key_,si_,strength_,\
706  sample_sn_,reject_reason_) \
707  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->reserve_entry(\
708  self_,rw_,key_,si_,strength_,\
709  sample_sn_,reject_reason_)
710 /*ci
711  * \brief Return/Cancel a queue reservation
712  *
713  * \details
714  *
715  * Return a previous reservation. Returning a reservation has no effect
716  * on the queue, and any resources allocated are returned.
717  *
718  * \param[in] self_ self
719  * \param[in] entry_ reservation to cancel
720  *
721  * \sa \ref RHSM_History_reserve_entry
722  */
723 #define DDSHST_Reader_return_entry(self_,entry_) \
724  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->return_entry(\
725  self_,entry_)
726 
727 /*ci
728  * \brief Add a reserved sample to the queue and commit one or more
729  *
730  * \details
731  * When a reservation is made the entry does not exist in the cache, only
732  * a sample to fill in exists. If the holder of the reservation decides to
733  * keep the sample it must be added. When a new sample is added it may also
734  * result in 1 or more samples being committed (for example if the newly
735  * added sample complete a sequence of samples).
736  *
737  * \param[in] self_ The history cache
738  * \param[in] entry_ The reserved entry to commit
739  * \param[in] sample_ The sample associated with the reservation
740  * \param[in] sn_ The first non-committable sequence number
741  *
742  * \sa \ref RHSM_History_reserve_entry
743  */
744 #define DDSHST_Reader_add_and_commit(self_,entry_,sample_,sn_) \
745  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->add_and_commit(\
746  self_,entry_,sample_,sn_)
747 
748 /*ci
749  * \brief Commit all cached samples up to a specific SN for a remote writer
750  *
751  * \details
752  * The history cache may stores samples received out of order to improve
753  * performance for reliable communication. If samples are received out of
754  * order there may be a backlog of samples until a sample is received that
755  * completes a sequence of samples. This function adds all these samples
756  * to the ordered list of samples.
757  *
758  * \param[in] self_ The history cache
759  * \param[in] rw_ The remote writer to commit samples for
760  * \param[in] sn_ The first non commitable sequence number
761  * \param[in] s_ The strength of the writer
762  *
763  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
764  * \ref DDSHST_ReturnCode_T on failure
765  */
766 #define DDSHST_Reader_commit(self_,rw_,sn_,s_) \
767  ((struct DDSHST_ReaderI*)((self_)->_parent._intf))->commit(\
768  self_,rw_,sn_,s_)
769 
770 /*
771  * \brief Read or take 1 or more samples matching a particular state from the
772  * history cache
773  *
774  * \details
775  * Return 0 or more samples and sample info. The sample_ptr_array and
776  * info_array must be pre-allocated to hold at least max_samples
777  * pointers. Note that the history _always_ operates on pointer to samples,
778  * it has no knowledge about types.
779  *
780  * \param[in] self_ The history cache to read from
781  * \param[inout] sample_arr_ A sequence of pointers to samples
782  * \param[inout] info_arr_ A sequence of pointers to sample info
783  * \param[in] count_ The actual number of samples returned
784  * \param[in] handle_ The instance to return (NIL is any instance)
785  * \param[in] max_samples_ The max number of samples to return (including
786  * the meta sample)
787  * \param[in] sample_states_ The requested sample state
788  * \param[in] view_states_ The requested view state
789  * \param[in] instance_states_ The requested instance state
790  * \param[in] take_ Whether this removes (RTI_TRUE) or leaves
791  * samples in the cache (RTI_FALSE)
792  *
793  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
794  * \ref DDSHST_ReturnCode_T on failure
795  */
796 #define DDSHST_Reader_read_or_take(self_,\
797  sample_arr_,info_arr_,count_,handle_,max_samples_,sample_states_,view_states_,\
798  instance_states_,take_) \
799  ((struct DDSHST_ReaderI*)(\
800  (self_)->_parent._intf))->read_or_take(self_,\
801  sample_arr_,info_arr_,count_,handle_,max_samples_,\
802  sample_states_,view_states_,instance_states_,take_)
803 
804 /*ci
805  * \brief Return a loan after calling \ref RHSM_History_read_or_take
806  *
807  * \param[in] self_ The history cache to return the sequences to
808  * \param[in] sample_seq_ A sequence of pointers to samples to return
809  * \param[in] info_seq_ A sequence of pointers to sample info to return
810  * \param[in] count_ The number of samples to return in each sequence
811  * \param[in] take_ Whether the samples where taken or not
812  *
813  * \return DDSHST_RETCODE_SUCCESS on success, one of the standard
814  * \ref DDSHST_ReturnCode_T on failure
815  *
816  * \sa \ref RHSM_History_read_or_take
817  */
818 #define DDSHST_Reader_finish_read_or_take(self_,sample_seq_,info_seq_,count_,take_) \
819  ((struct DDSHST_ReaderI*)(\
820  (self_)->_parent._intf))->finish_read_or_take(self_,\
821  sample_seq_,info_seq_,count_,take_)
822 
823 /*ci
824  * \brief Post an external event to the history cache
825  *
826  * \details
827  * This function is the entry point to signal the queue for various
828  * types of external events.
829  *
830  * \param[in] self_ The history cache
831  * \param[in] event_ The event that occurred
832  * \param[in] time_ The time the event occurred
833  */
834 #define DDSHST_Reader_post_event(self_,event_,time_) \
835  ((struct DDSHST_ReaderI*)(\
836  (self_)->_parent._intf))->post_event(self_,event_,time_)
837 
838 /*ci
839  * \brief Find and return a pointer to a key entry based on the instance handle
840  *
841  * \param[in] self_ The history cache
842  * \param[in] key_ The key entry to search for
843  *
844  * \return A key entry on success, NULL if the entry was not found
845  */
846 #define DDSHST_Reader_lookup_key(self_,key_) \
847  ((struct DDSHST_ReaderI*)(\
848  (self_)->_parent._intf))->lookup_key(self_,key_)
849 
850 #ifdef __cplusplus
851 } /* extern "C" */
852 #endif
853 
854 #endif /* dds_c_rh_plugin_h */
855 
856 /*ci @} */

RTI Connext Micro Version 2.4.4.0 Copyright © Thu Apr 30 2015 Real-Time Innovations, Inc