SST
14.0.0
StructuralSimulationToolkit
|
#include <sharedSet.h>
Data Structures | |
class | Data |
Public Types | |
typedef std::set< valT >::const_iterator | const_iterator |
typedef std::set< valT >::const_reverse_iterator | const_reverse_iterator |
Public Types inherited from SST::Shared::SharedObject | |
enum | verify_type { VERIFY_UNINITIALIZED, FE_VERIFY, INIT_VERIFY, NO_VERIFY } |
Enum of verify types. | |
Public Member Functions | |
int | initialize (const std::string &obj_name, verify_type v_type) |
Initialize the SharedSet. More... | |
size_t | size () const |
Get the size of the set. More... | |
bool | empty () const |
Tests if the set is empty. More... | |
size_t | count (const valT &k) const |
Counts elements with a specific value. More... | |
const_iterator | begin () const |
Get const_iterator to beginning of underlying set. | |
const_iterator | end () const |
Get const_iterator to end of underlying set. | |
const_reverse_iterator | rbegin () const |
Get const_reverse_iterator to beginning of underlying set. | |
const_reverse_iterator | rend () const |
Get const_reverse_iterator to end of underlying set. | |
void | publish () |
Indicate that the calling element has written all the data it plans to write. More... | |
bool | isFullyPublished () |
Check whether all instances of this SharedSet have called publish(). More... | |
void | insert (const valT &value) |
Insert data to the set. More... | |
const_iterator | find (const valT &value) const |
Searches the SharedSet for an element equivalent to value and returns a const iterator to it if found, otherwise it returns an iterator to SharedSet::end. More... | |
const valT & | mutex_find (const valT &value) const |
Searches the SharedSet for an element equivalent to value and returns a const iterator to it if found, otherwise it returns an iterator to SharedSet::end. More... | |
void | serialize_order (SST::Core::Serialization::serializer &ser) override |
Public Member Functions inherited from SST::Shared::SharedObject | |
virtual void | serialize_order (SST::Core::Serialization::serializer &UNUSED(ser)) override |
void | incPublishCount (SharedObjectData *data) |
int | incShareCount (SharedObjectData *data) |
Public Member Functions inherited from SST::Core::Serialization::serializable | |
virtual const char * | cls_name () const =0 |
virtual uint32_t | cls_id () const =0 |
virtual std::string | serialization_name () const =0 |
Data Fields | |
ImplementSerializable(SST::Shared::SharedSet< valT >) private Data * | data |
Additional Inherited Members | |
Static Public Attributes inherited from SST::Shared::SharedObject | |
static ImplementSerializable(SST::Shared::SharedObject) protected SharedObjectDataManager | manager |
Static Public Attributes inherited from SST::Core::Serialization::serializable | |
static constexpr uint32_t | NullClsId = std::numeric_limits<uint32_t>::max() |
Protected Types inherited from SST::Core::Serialization::serializable | |
enum | cxn_flag_t { ConstructorFlag } |
Static Protected Member Functions inherited from SST::Core::Serialization::serializable | |
static void | serializable_abort (uint32_t line, const char *file, const char *func, const char *obj) |
SharedSet class.
The class is templated to allow for an array of any non-pointer type. The type must be serializable.
|
inline |
Counts elements with a specific value.
Becuase this is not a multiset, it will either return 1 or 0.
|
inline |
Tests if the set is empty.
|
inline |
Searches the SharedSet for an element equivalent to value and returns a const iterator to it if found, otherwise it returns an iterator to SharedSet::end.
value | value to search for |
NOTE: This function does not use a mutex, so it is possible to get invalid results if another thread is simulateously writing to the set. However, after the init() phase of simulation is complete (in setup() and beyond), this is always a safe operation. If reading during init() and you can't guarantee that all elements have already written all elements to the SharedSet, use mutex_find() to guarantee thread safety.
|
inline |
Initialize the SharedSet.
obj_name | Name of the object. This name is how the object is uniquely identified across ranks. |
verify_mode | Specifies how multiply written data should be verified. Since the underlying set knows if the data has already been written, FE_VERIFY and INIT_VERIFY simply use this built-in mechanism to know when an item has previously been written. When these modes are enabled, multiply written data must match what was written before. When NO_VERIFY is passed, no verification will occur. This is mostly useful when you can guarantee that multiple elements won't write the same value and you want to do in-place modifications as you initialize. VERIFY_UNINITIALIZED is a reserved value and should not be passed. |
|
inline |
Insert data to the set.
This function is thread-safe, as a mutex is used to ensure only one insert at a time.
val | value of the insert |
|
inline |
|
inline |
Searches the SharedSet for an element equivalent to value and returns a const iterator to it if found, otherwise it returns an iterator to SharedSet::end.
This version of find is always thread safe (
value | value to search for |
|
inline |
Indicate that the calling element has written all the data it plans to write.
Writing to the set through this instance after publish() is called will create an error.
|
inline |
Get the size of the set.