RTI Connext DDS Micro  Version 2.4.8
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
reda_buffer.h
1 /*
2  * FILE: reda_buffer.h - Buffer API
3  *
4  * (c) Copyright, Real-Time Innovations, 2008-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  * 22sep2008,tk Created
16  *
17  */
18 /*ci
19  * \file
20  * \defgroup REDABufferClass REDA Buffer
21  * \ingroup REDAModule
22  * \brief Buffer API
23  *
24  * \details
25  * A REDA Buffer encapsulates a pointer to a character array and a length.
26  * No assumptions are made regarding the content of the octet array
27  */
28 /*ci \addtogroup REDABufferClass
29  * @{
30  */
31 #ifndef reda_buffer_h
32 #define reda_buffer_h
33 
34 #ifndef reda_dll_h
35 #include "reda/reda_dll.h"
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
43 /*ci
44  * \brief Generic buffer to hold data, described by a pointer to the data, as
45  * well as the length of the data.
46  */
47 struct REDA_Buffer
48 {
49  /*ci
50  * \brief Length of the buffer pointed to by pointer.
51  */
52  RTI_UINT32 length;
53 
54  /*ci
55  * \brief Pre-allocated (by the caller) buffer.
56  */
57  char *pointer;
58 };
59 
60 /*ci
61  * \brief Set the elements of a REDA_Buffer.
62  *
63  * \details
64  *
65  * Initialize a REDA buffer with a pre-allocated buffer. It is safer and
66  * more portable than setting the individual fields.
67  *
68  * @param[in] me REDA_Buffer structure to initialize
69  * @param[in] pointer Underlying memory for the buffer, pre-allocated by the
70  * caller
71  * @param[in] length The length of the underlying memory for the buffer
72  *
73  * \sa \ref REDA_Buffer_get
74 */
75 REDADllExport void
76 REDA_Buffer_set(struct REDA_Buffer *me,char *pointer,RTI_UINT32 length);
77 
78 /*ci
79  * \brief REDA_Buffer initializer
80  *
81  * \details
82  *
83  * REDA_Buffer initializer useful for initialization as indicated by
84  * the usage:
85  *
86  * \code
87  * struct REDA_Buffer buf = REDA_BUFFER_INVALID;
88  * \endcode
89 */
90 #define REDA_BUFFER_INVALID {0, NULL}
91 
92 #ifdef __cplusplus
93 } /* extern "C" */
94 #endif
95 
96 #endif /* reda_buffer_h */
97 
98 /*ci
99  * @}
100  */

RTI Connext DDS Micro Version 2.4.8 Copyright © Tue Apr 12 2016 Real-Time Innovations, Inc