MAK RTIspy API Documentation for HLA 4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VariableLengthData.h
Go to the documentation of this file.
1 #pragma once
2 /***********************************************************************
3  The IEEE hereby grants a general, royalty-free license to copy, distribute,
4  display and make derivative works from this material, for all purposes,
5  provided that any use of the material contains the following
6  attribution: "Reprinted with permission from IEEE 1516.1(TM)-2025".
7  Should you require additional information, contact the Manager, Standards
8  Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org).
9 ***********************************************************************/
10 
11 #include <RTI/SpecificConfig.h>
12 #include <cstddef>
13 
14 // A class to hold an arbitrary array of bytes for encoded values,
15 // attribute values, parameter values, etc. The class provides
16 // several ways of setting data, allowing tradeoffs between
17 // efficiency and memory management responsibility.
18 
19 namespace rti1516_2025
20 {
21  // Forward declaration for the RTI-internal class
22  // used to implement VariableLengthData
23  class VariableLengthDataImplementation;
24 
25  // Function to delete memory taken by instance of VariableLengthData class
26  typedef void (*VariableLengthDataDeleteFunction)(void* data);
27 
29  {
30  public:
32 
33  // Caller is free to delete inData after the call
35  void const * inData,
36  size_t inSize);
37 
38  // Caller is free to delete rhs after the call
40  VariableLengthData const & rhs);
41 
43 
44  // Caller is free to delete rhs after the call
45  // This instance will revert to internal storage as a result of assignment.
47  operator= (
48  VariableLengthData const & rhs);
49 
50  // This pointer should not be expected to be valid past the
51  // lifetime of this object, or past the next time this object
52  // is given new data
53  void const * data () const;
54 
55  size_t size () const;
56 
57  // Caller is free to delete inData after the call
58  void setData (
59  void const * inData,
60  size_t inSize);
61 
62  // Caller is responsible for ensuring that the data that is
63  // pointed to is valid for the lifetime of this object, or past
64  // the next time this object is given new data.
65  void setDataPointer (
66  void* inData,
67  size_t inSize);
68 
69  // Caller gives up ownership of inData to this object.
70  // This object assumes the responsibility of deleting inData
71  // when it is no longer needed.
72  // The allocation of inData is assumed to have been through an array
73  // alloctor (e.g., char* data = new char[20]. If the data was allocated
74  // in some other fashion, a deletion function must be supplied.
75  void takeDataPointer (
76  void* inData,
77  size_t inSize,
78  VariableLengthDataDeleteFunction func = nullptr);
79 
80  private:
81 
82  // Friend declaration for an RTI-internal class that
83  // can access the implementation of a VariableLengthValue
84  friend class VariableLengthDataFriend;
85 
86  VariableLengthDataImplementation* _impl;
87  };
88 }
89 
90 
#define RTI_EXPORT
Definition: SpecificConfig.h:45
VariableLengthDataImplementation * _impl
Definition: VariableLengthData.h:86
void(* VariableLengthDataDeleteFunction)(void *data)
Definition: VariableLengthData.h:26
This file contains definitions that are used to isolate platform-specific elements of the API...
Definition: VariableLengthData.h:28

Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)