Construct version 5.4.3
An agent based modeling framework
Social_Media_no_followers::media_event Struct Reference

A data structure to represent a tweet, facebook post, or any other social media event. More...

Inheritance diagram for Social_Media_no_followers::media_event:
Collaboration diagram for Social_Media_no_followers::media_event:

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_eventoperator= (media_event &&other) noexcept
 
 media_event (media_event &&temp) noexcept
 
 media_event (const media_event &temp)
 
media_eventoperator= (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
 
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
 
InteractionItemset_knowledge_item (unsigned int knowledge_index) noexcept
 Sets an item to become a knowledge item. More...
 
InteractionItemset_knowledgeTM_item (unsigned int knowledge_index, unsigned int alter_agent) noexcept
 Sets an item to become a knowledge transactive memory item. More...
 
InteractionItemset_belief_item (unsigned int belief_index, float belief_value) noexcept
 Sets an item to become a belief item. More...
 
InteractionItemset_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...
 
InteractionItemset_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 beliefs. 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...
 
 InteractionItem () noexcept
 
 InteractionItem (const InteractionItem &item) noexcept
 
InteractionItemoperator= (const InteractionItem &item) noexcept
 
 InteractionItem (InteractionItem &&item) noexcept
 
InteractionItemoperator= (InteractionItem &&item) noexcept
 

Public Attributes

media_eventparent_event = this
 The parent event if this event is not a post.
 
media_eventroot_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. More...
 
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_keysattributes
 

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.

Parameters
knowledge_indexValue the "knowledge" key in indexes is set to.
Returns
Returns a newly created item.
Example: More...
 
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
 

Detailed Description

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>

Constructor & Destructor Documentation

◆ ~media_event()

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.

◆ media_event() [1/3]

Social_Media_no_followers::media_event::media_event ( )
noexcept

Creates a blank event.

summary>

◆ media_event() [2/3]

Social_Media_no_followers::media_event::media_event ( media_event &&  temp)
noexcept

summary>

◆ media_event() [3/3]

Social_Media_no_followers::media_event::media_event ( const media_event temp)
inline

summary>

Member Function Documentation

◆ check_consistency()

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:

  • Posts have itself as its root event and parent event.
  • Replies, reposts, and quotes are listed in the corresponding data structure in the parent_event.
  • Replies, reposts, and quotes of this event have this as its parent event.
  • The root_event->last_used is equal to this->last_used.

If any of these conditions are not met of the event, an assertion is raised.

Here is the caller graph for this function:

◆ operator!=()

bool Social_Media_no_followers::media_event::operator!= ( const media_event a) const
inline

summary>

◆ operator<()

bool Social_Media_no_followers::media_event::operator< ( const media_event a) const
inline

summary>

◆ operator<=()

bool Social_Media_no_followers::media_event::operator<= ( const media_event a) const
inline

summary>

◆ operator=()

Social_Media_no_followers::media_event & Social_Media_no_followers::media_event::operator= ( media_event &&  other)
noexcept

summary>

◆ operator==()

bool Social_Media_no_followers::media_event::operator== ( const media_event a) const
inline

summary>

◆ operator>=()

bool Social_Media_no_followers::media_event::operator>= ( const media_event a) const
inline

summary>

◆ update_last_used()

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.

Here is the caller graph for this function:

Member Data Documentation

◆ score

float Social_Media_no_followers::media_event::score = 1

Gets set to its child_size * time_stamp during Social_Media_with_followers::update_feeds.

summary>