12 #ifndef SST_CORE_CORE_SHAREDREGION_H
13 #define SST_CORE_CORE_SHAREDREGION_H
15 #include "sst/core/warnmacros.h"
16 #include "sst/core/sst_types.h"
21 #if !SST_BUILDING_CORE
22 #warning "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."
43 virtual bool merge(uint8_t *target,
const uint8_t *newData,
size_t size);
44 virtual bool merge(uint8_t *target,
size_t size,
const std::vector<ChangeSet> &changeSets);
52 defVal = defaultValue;
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;
131 virtual void updateState(
bool finalize) = 0;
147 virtual void setPointer(
const void *p) = 0;
150 template <
typename T>
157 void setPointer(
const void *p) {
158 ptr =
static_cast<const T
>(p);
167 deferred_pointer(nullptr)
176 DISABLE_WARN_DEPRECATED_DECLARATION ;
177 manager->shutdownSharedRegion(
this);
190 size_t getSize()
const {
return manager->getSize(
this); }
196 DISABLE_WARN_DEPRECATED_DECLARATION;
197 manager->publishRegion(
this);
210 DISABLE_WARN_DEPRECATED_DECLARATION;
211 return manager->isRegionReady(
this);
222 { manager->modifyRegion(
this, offset, length, data); }
231 { manager->modifyRegion(
this, offset*
sizeof(T),
sizeof(T), &data); }
250 return static_cast<T
>(manager->getConstPtr(
this));
274 if ( deferred_pointer !=
nullptr )
return;
void modifyRegion(size_t offset, size_t length, const void *data)
Before the region has published, apply a modification.
Definition: sharedRegion.h:221
Definition: sharedRegion.h:135
bool merge(uint8_t *target, const uint8_t *newData, size_t size) override
Merge the data from 'newData' into 'target'.
Definition: sharedRegion.cc:78
bool isReady() const
Check to see if the region is ready (all elements requesting the region have called publish())...
Definition: sharedRegion.h:209
Definition: sharedRegion.h:144
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:268
void * getRawPtr()
Definition: sharedRegion.h:239
Utility class to define how to merge multiple pieces of shared memory regions Useful in the multi-MPI...
Definition: sharedRegion.h:34
void publish()
Call to denote that you are done making any changes to this region.
Definition: sharedRegion.h:195
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:184
void modifyArray(size_t offset, const T &data)
Before the region has published, apply a modification.
Definition: sharedRegion.h:230
T getPtr() const
Get a pointer to the const shared data.
Definition: sharedRegion.h:249
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:190
Definition: sharedRegion.h:151
Definition: sharedRegion.h:64