12 #ifndef SST_CORE_SHAREDREGION_H
13 #define SST_CORE_SHAREDREGION_H
15 #include "sst/core/sst_types.h"
16 #include "sst/core/warnmacros.h"
21 #if !SST_BUILDING_CORE
23 "SharedRegion and its accompanying classes have been deprecated and will be removed in SST 12. Please use the new SharedObject classes found in sst/core/shared."
44 virtual bool merge(uint8_t* target,
const uint8_t* newData,
size_t size);
45 virtual bool merge(uint8_t* target,
size_t size,
const std::vector<ChangeSet>& changeSets);
55 bool merge(uint8_t* target,
const uint8_t* newData,
size_t size)
override;
57 bool merge(uint8_t* target,
size_t size,
const std::vector<ChangeSet>& changeSets)
override
68 virtual void modifyRegion(
SharedRegion* sr,
size_t offset,
size_t length,
const void* data) = 0;
70 virtual const void* getConstPtr(
const SharedRegion* sr)
const = 0;
71 virtual size_t getSize(
const SharedRegion* sr)
const = 0;
119 const std::string& key,
size_t size,
SharedRegionMerger* merger =
nullptr, uint8_t initByte = 0) = 0;
130 virtual void updateState(
bool finalize) = 0;
144 virtual void setPointer(
const void* p) = 0;
147 template <
typename T>
155 void setPointer(
const void* p) { ptr =
static_cast<const T
>(p); }
167 DISABLE_WARN_DEPRECATED_DECLARATION;
168 manager->shutdownSharedRegion(
this);
181 size_t getSize()
const {
return manager->getSize(
this); }
188 DISABLE_WARN_DEPRECATED_DECLARATION;
189 manager->publishRegion(
this);
202 DISABLE_WARN_DEPRECATED_DECLARATION;
203 return manager->isRegionReady(
this);
214 manager->modifyRegion(
this, offset, length, data);
222 template <
typename T>
225 manager->modifyRegion(
this, offset *
sizeof(T),
sizeof(T), &data);
243 template <
typename T>
246 return static_cast<T
>(manager->getConstPtr(
this));
262 template <
typename T>
270 if ( deferred_pointer !=
nullptr )
return;
277 #endif // SST_CORE_SHAREDREGION_H
void modifyRegion(size_t offset, size_t length, const void *data)
Before the region has published, apply a modification.
Definition: sharedRegion.h:212
Definition: sharedRegion.h:133
bool merge(uint8_t *target, const uint8_t *newData, size_t size) override
Merge the data from 'newData' into 'target'.
Definition: sharedRegion.cc:75
bool isReady() const
Check to see if the region is ready (all elements requesting the region have called publish())...
Definition: sharedRegion.h:200
Definition: sharedRegion.h:140
void getPtrDeferred(T &ptr)
Used to get a pointer to the const shared data when the element doesn't yet know the size...
Definition: sharedRegion.h:263
void * getRawPtr()
Definition: sharedRegion.h:234
Utility class to define how to merge multiple pieces of shared memory regions Useful in the multi-MPI...
Definition: sharedRegion.h:35
void publish()
Call to denote that you are done making any changes to this region.
Definition: sharedRegion.h:186
virtual SharedRegion * getLocalSharedRegion(const std::string &key, size_t size, uint8_t initByte=0)=0
Create a SharedRegion that will only be shared with elements on the current rank. ...
size_t getLocalShareID() const
Definition: sharedRegion.h:175
void modifyArray(size_t offset, const T &data)
Before the region has published, apply a modification.
Definition: sharedRegion.h:223
T getPtr() const
Get a pointer to the const shared data.
Definition: sharedRegion.h:244
virtual bool merge(uint8_t *target, const uint8_t *newData, size_t size)
Merge the data from 'newData' into 'target'.
virtual SharedRegion * getGlobalSharedRegion(const std::string &key, size_t size, SharedRegionMerger *merger=nullptr, uint8_t initByte=0)=0
Create a SharedRegion that will be shared with elements on the all ranks.
Definition: sharedRegion.h:48
size_t getSize() const
Definition: sharedRegion.h:181
Definition: sharedRegion.h:148
Definition: sharedRegion.h:63