SST
12.0.1
StructuralSimulationToolkit
|
#include <sharedSet.h>
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... | |
Additional Inherited Members | |
Protected Member Functions inherited from SST::Shared::SharedObject | |
void | incPublishCount (SharedObjectData *data) |
int | incShareCount (SharedObjectData *data) |
Static Protected Attributes inherited from SST::Shared::SharedObject | |
static SharedObjectDataManager | manager |
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.