11 #ifndef _EMBEDDED_RPC__MANUALLY_CONSTRUCTED_H_ 12 #define _EMBEDDED_RPC__MANUALLY_CONSTRUCTED_H_ 14 #include "erpc_config_internal.h" 58 T *operator->(
void) {
return get(); }
59 const T *operator->(
void)
const {
return get(); }
72 const T &operator*(
void)
const 81 return reinterpret_cast<const T &
>(
m_storage);
84 operator T *(void) {
return get(); }
85 operator const T *(void)
const {
return get(); }
97 template <
typename A1>
98 void construct(
const A1 &a1)
105 template <
typename A1,
typename A2>
106 void construct(
const A1 &a1,
const A2 &a2)
113 template <
typename A1,
typename A2,
typename A3>
114 void construct(
const A1 &a1,
const A2 &a2,
const A3 &a3)
121 template <
typename A1,
typename A2,
typename A3,
typename A4>
122 void construct(
const A1 &a1,
const A2 &a2,
const A3 &a3,
const A4 &a4)
129 template <
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
130 void construct(
const A1 &a1,
const A2 &a2,
const A3 &a3,
const A4 &a4,
const A5 &a5)
137 template <
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
typename A6>
138 void construct(
const A1 &a1,
const A2 &a2,
const A3 &a3,
const A4 &a4,
const A5 &a5,
const A6 &a6)
141 new (
m_storage) T(a1, a2, a3, a4, a5, a6);
174 uint64_t
m_storage[(
sizeof(T) +
sizeof(uint64_t) - 1) /
sizeof(uint64_t)];
184 #define ERPC_MANUALLY_CONSTRUCTED(class, variableName) static ManuallyConstructed<class> variableName 185 #define ERPC_MANUALLY_CONSTRUCTED_ARRAY(class, variableName, dimension) \ 186 ERPC_MANUALLY_CONSTRUCTED(class, variableName)[dimension] 188 #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC 189 #define ERPC_MANUALLY_CONSTRUCTED_STATIC(class, variableName) ERPC_MANUALLY_CONSTRUCTED(class, variableName) 191 #define ERPC_MANUALLY_CONSTRUCTED_STATIC(class, variableName) 194 #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC 195 #define ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(class, variableName, dimension) \ 196 ERPC_MANUALLY_CONSTRUCTED_ARRAY(class, variableName, dimension) 198 #define ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(class, variableName, dimension) 201 #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC 202 #define ERPC_CREATE_NEW_OBJECT(class, arrayOfObjects, numberOfObjects, ...) \ 203 return new (std::nothrow) class(__VA_ARGS__); 205 #define ERPC_DESTROY_OBJECT(object, ...) delete object; 207 #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC 208 #define ERPC_CREATE_NEW_OBJECT(class, arrayOfObjects, numberOfObjects, ...) \ 209 uint8_t objectsIterator; \ 211 for (objectsIterator = 0; objectsIterator < numberOfObjects; objectsIterator++) \ 213 if (!arrayOfObjects[objectsIterator].isUsed()) \ 215 arrayOfObjects[objectsIterator].construct(__VA_ARGS__); \ 216 ret = arrayOfObjects[objectsIterator].get(); \ 222 #define ERPC_DESTROY_OBJECT(object, arrayOfObjects, numberOfObjects) \ 223 uint8_t objectsIterator; \ 224 for (objectsIterator = 0; objectsIterator < numberOfObjects; objectsIterator++) \ 226 if (object == arrayOfObjects[objectsIterator].get()) \ 228 arrayOfObjects[objectsIterator].destroy(); \ 238 #endif // _EMBEDDED_RPC__MANUALLY_CONSTRUCTED_H_ uint64_t m_storage[(sizeof(T)+sizeof(uint64_t)-1)/sizeof(uint64_t)]
Storage for the object.
Definition: erpc_manually_constructed.hpp:174
bool m_isConstructed
Track construct/destruct calls.
Definition: erpc_manually_constructed.hpp:181
bool isUsed(void)
Returns information if object is free or is used.
Definition: erpc_manually_constructed.hpp:166
Definition: erpc_arbitrated_client_manager.hpp:25
void destroy(void)
Invoke the object's destructor.
Definition: erpc_manually_constructed.hpp:151
Allocates static storage for an object.
Definition: erpc_manually_constructed.hpp:51