Construct version 5.4.4
An agent based modeling framework
|
A data structure to represent a tweet, facebook post, or any other social media event. More...
Public Types | |
enum class | event_type : char { post , repost , quote , reply } |
The different types of events available. | |
Public Types inherited from InteractionItem | |
enum class | item_keys : char { knowledge , alter , belief , ktm , btm , ktrust , twitter_event , facebook_event , feed_position , emotion , banned , upvotes , downvotes , subreddit , prev_banned , reddit_event } |
using | attribute_iterator = std::unordered_set< item_keys >::iterator |
using | attribute_const_iterator = std::unordered_set< item_keys >::const_iterator |
using | index_iterator = std::unordered_map< item_keys, unsigned int >::iterator |
using | index_const_iterator = std::unordered_map< item_keys, unsigned int >::const_iterator |
using | value_iterator = std::unordered_map< item_keys, float >::iterator |
using | value_const_iterator = std::unordered_map< item_keys, float >::const_iterator |
Public Member Functions | |
void | update_last_used (float time) |
Updates this event's last_updated variable with the submitted time. More... | |
~media_event () | |
Performs no actions unless DEBUG is enabled in which various assertions are checked. More... | |
media_event () noexcept | |
Creates a blank event. More... | |
media_event & | operator= (media_event &&other) noexcept |
media_event (media_event &&temp) noexcept | |
media_event (const media_event &temp) | |
media_event & | operator= (const media_event &temp) |
unsigned int | child_size (void) |
Returns the size of the tree of events with this event at its root (minimum size of 1). | |
bool | operator== (const media_event &a) const |
Indicates whether this post has been removed/banned. More... | |
bool | operator!= (const media_event &a) const |
bool | operator<= (const media_event &a) const |
bool | operator>= (const media_event &a) const |
bool | operator< (const media_event &a) const |
bool | operator> (const media_event &a) const |
void | update_root (media_event *new_root) |
Updates all events' root_event in a the sub-tree to the submitted event. | |
void | check_consistency (void) const |
Checks whether the event is properly linked in the event tree. More... | |
Public Member Functions inherited from InteractionItem | |
bool | contains (item_keys key) const |
InteractionItem & | set_knowledge_item (unsigned int knowledge_index) noexcept |
Sets an item to become a knowledge item. More... | |
InteractionItem & | set_knowledgeTM_item (unsigned int knowledge_index, unsigned int alter_agent) noexcept |
Sets an item to become a knowledge transactive memory item. More... | |
InteractionItem & | set_belief_item (unsigned int belief_index, float belief_value) noexcept |
Sets an item to become a belief item. More... | |
InteractionItem & | set_beliefTM_item (unsigned int belief_index, unsigned int alter_agent, float belief_value) noexcept |
Sets an item to become a belief transactive memory item. More... | |
InteractionItem & | set_knowledge_trust_item (unsigned int knowledge_index, float ktrust) noexcept |
Sets an item to become a knowledge trust item. More... | |
unsigned int | get_knowledge () const |
Parses an item for knowledge More... | |
std::tuple< unsigned int, unsigned int > | get_knowledgeTM () const |
Parses an item for knowledge transactive memory More... | |
std::tuple< unsigned int, float > | get_belief () const |
Parses an item for beliefs. More... | |
std::tuple< unsigned int, unsigned int, float > | get_beliefTM () const |
Parses an item for belief transactive memory. More... | |
std::tuple< unsigned int, float > | get_knowledge_trust () const |
Parses an item for knowledge trust. More... | |
void | clear (void) noexcept |
Clears all containers in item. More... | |
Public Attributes | |
media_event * | parent_event = this |
The parent event if this event is not a post. | |
media_event * | root_event = this |
The root event of the event tree this is apart of. | |
std::set< media_event * > | reposts |
The list of repostes that have shared this event. | |
std::set< media_event * > | replies |
The list of replies to this event. | |
std::set< media_event * > | quotes |
The list of events that quoted this event. | |
std::set< unsigned int > | mentions |
The list of agent indexes that are mentioned in this event. | |
unsigned int | user = 0 |
The agent index of the user that posted the event. | |
float | time_stamp = -1 |
The time that this event was created. | |
float | last_used = -1 |
The last time that the associated event tree was updated. | |
float | score = 1 |
Gets set to its child_size * time_stamp during Social_Media_with_followers::update_feeds. | |
event_type | type = event_type::post |
The type of event this is i.e. "post","repost", "quote", or "reply". | |
Public Attributes inherited from InteractionItem | |
std::unordered_map< item_keys, unsigned int > | indexes |
std::unordered_map< item_keys, float > | values |
std::unordered_set< item_keys > | attributes |
Additional Inherited Members | |||
Static Public Member Functions inherited from InteractionItem | |||
static const std::string & | get_item_name (InteractionItem::item_keys key) | ||
Returns the name registered in InteractionItem::item_names for the submitted key. | |||
static InteractionItem::item_keys | get_item_key (const std::string &name) | ||
Returns the key registered in InteractionItem::item_names for the submitted name. More... | |||
static InteractionItem | create_knowledge_item (unsigned int knowledge_index) noexcept | ||
Creates a knowledge item using set_knowledge_item.
| |||
static InteractionItem | create_knowledgeTM_item (unsigned int knowledge_index, unsigned int alter_agent) noexcept | ||
Creates a knowledge transactive memory item using set_knowledgeTM_item. More... | |||
static InteractionItem | create_belief_item (unsigned int belief_index, float belief_value) noexcept | ||
Creates a belief item using set_beliefTM_item. More... | |||
static InteractionItem | create_beliefTM_item (unsigned int belief_index, unsigned int alter_agent, float belief_value) noexcept | ||
Creates a belief transactive memory item using set_beliefTM_item. More... | |||
static InteractionItem | create_knowledge_trust_item (unsigned int knowledge_index, float ktrust) noexcept | ||
Creates a knowledge trust item using set_knowledge_trust_item. More... | |||
Static Public Attributes inherited from InteractionItem | |||
static std::unordered_map< InteractionItem::item_keys, std::string > | item_names | ||
A data structure to represent a tweet, facebook post, or any other social media event.
Events are linked into a tree with the root_event as the base of an event tree. Child events are contained in media_event::(replies, quotes, reposts). The non-default non-post constructors automatically link themselves to the their parent events. When an event is added to a tree using a non-default constructor, all other events in that tree have their media_event::last_used updated to be equal to the added event's media_event::time_stamp.
summary>
Social_Media_no_followers::media_event::~media_event | ( | ) |
Performs no actions unless DEBUG is enabled in which various assertions are checked.
media_event::last_used is checked between this event, parent_event, root_event, and all replies, quotes, and reposts. An assertion is raised if any event in a tree isn't synced. Next, the event removes itself from the parent event's replies, quotes, or reposts depending on media_event::type. An assertion is raised if it can not find itself in the corresponding data structure. Finally, the event sets all child event's media_event::parent_event their this pointer. An assertion is raised if this event is not the child event's parent_event. These assertions yield the relevant pointers as a string for debugging purposes and ensure that the event tree was properly synced.
|
noexcept |
Creates a blank event.
summary>
|
noexcept |
summary>
|
inline |
summary>
void Social_Media_no_followers::media_event::check_consistency | ( | void | ) | const |
Checks whether the event is properly linked in the event tree.
Checks to make sure:
If any of these conditions are not met of the event, an assertion is raised.
|
inline |
summary>
|
inline |
summary>
|
inline |
summary>
|
noexcept |
summary>
|
inline |
Indicates whether this post has been removed/banned.
summary>
|
inline |
summary>
void Social_Media_no_followers::media_event::update_last_used | ( | float | time | ) |
Updates this event's last_updated variable with the submitted time.
When this event is updated, this function is also called on all this event's child events.