19#ifndef HEADER_ONLINE_PROFILE_MANAGER_HPP
20#define HEADER_ONLINE_PROFILE_MANAGER_HPP
Class that represents an online profile.
Definition: online_profile.hpp:42
Class that manages all online profiles.
Definition: profile_manager.hpp:43
void updateFriendFlagsInCache(const ProfilesMap &cache, uint32_t profile_id)
This function is called when the specified profile id is removed from cache.
Definition: profile_manager.cpp:176
void clearPersistent()
Deletes all persistent profiles.
Definition: profile_manager.cpp:295
OnlineProfile * getProfileByID(const uint32_t id)
Search for a given profile in the set of persistent and cached entries.
Definition: profile_manager.cpp:86
ProfilesMap m_profiles_cache
Any profiles that don't go into the persistent map, go here.
Definition: profile_manager.hpp:62
bool isInCache(const uint32_t id)
Checks if a profile is in cache.
Definition: profile_manager.cpp:156
void addDirectToCache(OnlineProfile *profile)
Initialisation before the object is displayed.
Definition: profile_manager.cpp:123
std::map< uint32_t, OnlineProfile * > ProfilesMap
The mapping of ids to profile.
Definition: profile_manager.hpp:52
static void destroy()
Destroys the singleton.
Definition: profile_manager.hpp:97
bool inPersistent(const uint32_t id)
True if the profile with the given id is persistent.
Definition: profile_manager.cpp:244
void updateCacheBits(OnlineProfile *profile)
This function updates the cache bits of all cached entries.
Definition: profile_manager.cpp:216
int guaranteeCacheSize(unsigned int max_num)
Makes sure that the cache can store at least max_num entries.
Definition: profile_manager.cpp:66
OnlineProfile * getVisitingProfile()
Definition: profile_manager.hpp:126
void moveToCache(const uint32_t id)
Removes a currently persistent profile to the cache (where it can be deleted later).
Definition: profile_manager.cpp:311
ProfileManager()
Private constructor, used by static create() function.
Definition: profile_manager.cpp:40
static void create()
Create the singleton instance.
Definition: profile_manager.hpp:80
ProfilesMap m_profiles_persistent
A map of profiles that is persistent.
Definition: profile_manager.hpp:57
void deleteFromPersistent(const uint32_t id)
Removes and deletes an entry from the persistent map.
Definition: profile_manager.cpp:276
~ProfileManager()
Destructor, which frees the persistent and cached data.
Definition: profile_manager.cpp:49
OnlineProfile * addPersistent(OnlineProfile *profile)
Adds a profile to the persistent map.
Definition: profile_manager.cpp:256
void updateAllFriendFlags(const OnlineProfile *profile)
This function is called when the specified profile is removed from cache.
Definition: profile_manager.cpp:200
void setVisiting(const uint32_t id)
Marks a given profile to be the currently visited one.
Definition: profile_manager.hpp:118
OnlineProfile * m_currently_visiting
A temporary profile that is currently being 'visited', e.g.
Definition: profile_manager.hpp:66
static ProfileManager * get()
Returns the singleton.
Definition: profile_manager.hpp:90
void addToCache(OnlineProfile *profile)
Adds profile to the cache.
Definition: profile_manager.cpp:105
static ProfileManager * m_profile_manager
Singleton pointer.
Definition: profile_manager.hpp:46
unsigned int m_max_cache_size
The max size of the m_profiles cache.
Definition: profile_manager.hpp:71
Declares the general types that are used by the network.