One UI session. More...
#include <session_manager.h>
Public Member Functions | |
| Session (long timeout) | |
| Constructor, creates a session with a given timeout. | |
| struct timespec * | getLastAccessTime () |
| Returns the time of last access to the session. | |
| long | getTimeout () |
| zmm::String | getID () |
| Returns the session identifier. | |
| void | setID (zmm::String sessionID) |
| Sets the session identifier. | |
| bool | isLoggedIn () |
| void | logIn () |
| void | logOut () |
| void | access () |
| zmm::String | getUIUpdateIDs () |
| Returns the updateIDs, collected for the sessions, and flushes the storage for the ids. | |
| bool | hasUIUpdateIDs () |
| void | clearUpdateIDs () |
| void | put (zmm::String key, zmm::String value) |
| Adds a new key:value pair to the dictionary. | |
| zmm::String | get (zmm::String key) |
| Returns the value for a given key. | |
| void | remove (zmm::String key) |
| Deletes a key value pair. | |
| zmm::String | encode () |
| Returns an url encoded version of the whole dictionary. | |
| void | clear () |
| Removes all elements from the dictionary. | |
| void | decode (zmm::String url) |
| Makes a dictionary out of url encoded data. | |
| zmm::Ref< Dictionary_r > | clone () |
| Makes a shallow copy of the dictionary. | |
| bool | isSubsetOf (zmm::Ref< Dictionary > other) |
| bool | isSubsetOf (zmm::Ref< Dictionary > other) |
| returns true if the dictionary is a subset of another dictionary.# | |
| bool | equals (zmm::Ref< Dictionary > other) |
| bool | equals (zmm::Ref< Dictionary > other) |
| checks two dictionaries for equality | |
| zmm::Ref< zmm::Array < DictionaryElement > > | getElements () |
| void | optimize () |
| Frees unnecessary memory. | |
| int | size () |
| Returns the number of elements in the dictinary. | |
| zmm::String | encodeSimple () |
| It seems that a lot of devices can not cope with a param=value encoded URL, so we will use a simplified encoding scheme. | |
| void | decodeSimple (zmm::String url) |
| Makes a dictionary out of simplified url encoded data. | |
| void | merge (zmm::Ref< Dictionary > other) |
| Merge dictionary with another dictionary. If keys with the same name already exist, the existing ones will be overwritten. | |
| void | retain () |
| void | release () |
| int | getRefCount () |
Static Public Member Functions | |
| static void * | operator new (size_t size) |
| static void | operator delete (void *ptr) |
Protected Member Functions | |
| void | containerChangedUI (int objectID) |
| Is called by SessionManager if UI update is needed. | |
| void | containerChangedUI (zmm::Ref< zmm::IntArray > objectIDs) |
| zmm::String | _encode (char sep1, char sep2) |
| Allow to specify encoding separators. | |
Protected Attributes | |
| bool | updateAll |
| True if the ui update id hash became to big and the UI shall update every container. | |
| zmm::Ref< DBRHash< int > > | uiUpdateIDs |
| long | timeout |
| maximum time the session can be idle (starting from last_access) | |
| struct timespec | last_access |
| time of last access to the session, returned by getLastAccessTime() | |
| zmm::String | sessionID |
| arbitrary but unique string representing the ID of the session (returned by getID()) | |
| bool | loggedIn |
| zmm::Ref< Mutex > | mutex |
| zmm::Ref< zmm::Array < DictionaryElement > > | elements |
| Array of DictionaryElements, representing our Dictionary. | |
| mt_atomic_t | _ref_count |
Friends | |
| class | SessionManager |
One UI session.
When the user logs in for the first time (via the web UI) a new Session will be created. It then will be used to store various information to support the UI - remember the position of browsing for each driver, remember the page count for each driver and so on.
Definition at line 47 of file session_manager.h.
| Session::Session | ( | long | timeout | ) |
Constructor, creates a session with a given timeout.
| timeout | time in milliseconds after which the session will expire if not accessed. |
The session is created with a given timeout, each access to the session updates the last_access value, if last access lies further back than the timeout - the session will be deleted (will time out)
Definition at line 51 of file session_manager.cc.
References access(), INVALID_OBJECT_ID, INVALID_OBJECT_ID_2, loggedIn, MAX_UI_UPDATE_IDS, nil, sessionID, UI_UPDATE_ID_HASH_SIZE, uiUpdateIDs, and updateAll.
| String Dictionary::_encode | ( | char | sep1, | |
| char | sep2 | |||
| ) | [protected, inherited] |
Allow to specify encoding separators.
Definition at line 122 of file dictionary.cc.
References Dictionary::elements, and url_escape().
Referenced by Dictionary::encode(), and Dictionary::encodeSimple().
| void Session::access | ( | ) | [inline] |
Definition at line 76 of file session_manager.h.
References getTimespecNow(), and last_access.
Referenced by Session().
| void Dictionary_r::clear | ( | ) | [inline, inherited] |
Removes all elements from the dictionary.
Reimplemented from Dictionary.
Definition at line 164 of file dictionary.h.
References Dictionary_r::mutex.
| void Session::clearUpdateIDs | ( | ) |
Definition at line 129 of file session_manager.cc.
References AUTOLOCK, log_debug, Dictionary_r::mutex, uiUpdateIDs, and updateAll.
| zmm::Ref<Dictionary_r> Dictionary_r::clone | ( | ) | [inline, inherited] |
Makes a shallow copy of the dictionary.
Reimplemented from Dictionary.
Definition at line 178 of file dictionary.h.
References Dictionary::clone(), Dictionary_r::mutex, and RefCast.
| void Session::containerChangedUI | ( | zmm::Ref< zmm::IntArray > | objectIDs | ) | [protected] |
Definition at line 81 of file session_manager.cc.
References AUTOLOCK, MAX_UI_UPDATE_IDS, Dictionary_r::mutex, nil, uiUpdateIDs, and updateAll.
| void Session::containerChangedUI | ( | int | objectID | ) | [protected] |
Is called by SessionManager if UI update is needed.
| objectID | the container that needs to be updated |
Definition at line 61 of file session_manager.cc.
References AUTOLOCK, INVALID_OBJECT_ID, MAX_UI_UPDATE_IDS, Dictionary_r::mutex, uiUpdateIDs, and updateAll.
| void Dictionary_r::decode | ( | zmm::String | url | ) | [inline, inherited] |
Makes a dictionary out of url encoded data.
Reimplemented from Dictionary.
Definition at line 171 of file dictionary.h.
References Dictionary_r::mutex.
| void Dictionary::decodeSimple | ( | zmm::String | url | ) | [inherited] |
Makes a dictionary out of simplified url encoded data.
Definition at line 174 of file dictionary.cc.
References zmm::String::index(), zmm::String::length(), Dictionary::put(), zmm::String::substring(), and url_unescape().
| zmm::String Dictionary_r::encode | ( | ) | [inline, inherited] |
Returns an url encoded version of the whole dictionary.
Reimplemented from Dictionary.
Definition at line 156 of file dictionary.h.
References Dictionary_r::mutex.
| String Dictionary::encodeSimple | ( | ) | [inherited] |
It seems that a lot of devices can not cope with a param=value encoded URL, so we will use a simplified encoding scheme.
Definition at line 142 of file dictionary.cc.
References Dictionary::_encode().
| bool Dictionary::equals | ( | zmm::Ref< Dictionary > | other | ) | [inherited] |
checks two dictionaries for equality
Definition at line 242 of file dictionary.cc.
References Dictionary::isSubsetOf().
| bool Dictionary_r::equals | ( | zmm::Ref< Dictionary > | other | ) | [inline, inherited] |
Definition at line 194 of file dictionary.h.
References Dictionary_r::mutex.
| zmm::String Dictionary_r::get | ( | zmm::String | key | ) | [inline, inherited] |
Returns the value for a given key.
Reimplemented from Dictionary.
Definition at line 141 of file dictionary.h.
References Dictionary_r::mutex.
| zmm::Ref<zmm::Array<DictionaryElement> > Dictionary_r::getElements | ( | ) | [inline, inherited] |
Reimplemented from Dictionary.
Definition at line 202 of file dictionary.h.
References Dictionary_r::mutex.
| zmm::String Session::getID | ( | ) | [inline] |
Returns the session identifier.
Definition at line 65 of file session_manager.h.
References sessionID.
| struct timespec* Session::getLastAccessTime | ( | ) | [inline, read] |
Returns the time of last access to the session.
Definition at line 60 of file session_manager.h.
References last_access.
| int Object::getRefCount | ( | ) | [inherited] |
Definition at line 78 of file object.cc.
References zmm::Object::_ref_count, and atomic_get().
| long Session::getTimeout | ( | ) | [inline] |
Definition at line 62 of file session_manager.h.
| String Session::getUIUpdateIDs | ( | ) |
Returns the updateIDs, collected for the sessions, and flushes the storage for the ids.
Definition at line 103 of file session_manager.cc.
References _, AUTOLOCK, hash_data_array_t< KT >::data, hasUIUpdateIDs(), intArrayToCSV(), Dictionary_r::mutex, nil, hash_data_array_t< KT >::size, uiUpdateIDs, and updateAll.
| bool Session::hasUIUpdateIDs | ( | ) |
Definition at line 121 of file session_manager.cc.
References uiUpdateIDs, and updateAll.
Referenced by getUIUpdateIDs().
| bool Session::isLoggedIn | ( | ) | [inline] |
Definition at line 70 of file session_manager.h.
References loggedIn.
| bool Dictionary::isSubsetOf | ( | zmm::Ref< Dictionary > | other | ) | [inherited] |
returns true if the dictionary is a subset of another dictionary.#
Definition at line 231 of file dictionary.cc.
References Dictionary::elements.
Referenced by Dictionary::equals().
| bool Dictionary_r::isSubsetOf | ( | zmm::Ref< Dictionary > | other | ) | [inline, inherited] |
Definition at line 186 of file dictionary.h.
References Dictionary_r::mutex.
| void Session::logIn | ( | ) | [inline] |
Definition at line 72 of file session_manager.h.
References loggedIn.
| void Session::logOut | ( | ) | [inline] |
Definition at line 74 of file session_manager.h.
References loggedIn.
| void Dictionary::merge | ( | zmm::Ref< Dictionary > | other | ) | [inherited] |
Merge dictionary with another dictionary. If keys with the same name already exist, the existing ones will be overwritten.
Definition at line 217 of file dictionary.cc.
References nil, and Dictionary::put().
| void Object::operator delete | ( | void * | ptr | ) | [static, inherited] |
| void * Object::operator new | ( | size_t | size | ) | [static, inherited] |
| void Dictionary_r::optimize | ( | ) | [inline, inherited] |
Frees unnecessary memory.
Reimplemented from Dictionary.
Definition at line 210 of file dictionary.h.
References Dictionary_r::mutex.
| void Dictionary_r::put | ( | zmm::String | key, | |
| zmm::String | value | |||
| ) | [inline, inherited] |
Adds a new key:value pair to the dictionary.
Reimplemented from Dictionary.
Definition at line 134 of file dictionary.h.
References Dictionary_r::mutex.
| void Object::release | ( | ) | [inherited] |
Definition at line 66 of file object.cc.
References zmm::Object::_ref_count, atomic_dec(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::clear(), zmm::String::operator=(), DSOHash< zmm::Array< CacheObject > >::releaseData(), DSBHash< VT >::releaseData(), DSOHash< zmm::Array< CacheObject > >::remove(), zmm::ArrayBase::remove(), zmm::ArrayBase::removeUnordered(), zmm::ArrayBase::set(), zmm::ArrayBase::~ArrayBase(), DSOHash< zmm::Array< CacheObject > >::~DSOHash(), zmm::ObjectQueue< AutoscanDirectory >::~ObjectQueue(), zmm::ObjectStack< Element >::~ObjectStack(), and zmm::String::~String().
| void Dictionary_r::remove | ( | zmm::String | key | ) | [inline, inherited] |
Deletes a key value pair.
Reimplemented from Dictionary.
Definition at line 149 of file dictionary.h.
References Dictionary_r::mutex.
| void Object::retain | ( | ) | [inherited] |
Definition at line 58 of file object.cc.
References zmm::Object::_ref_count, atomic_inc(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::append(), zmm::ObjectQueue< AutoscanDirectory >::enqueue(), zmm::ArrayBase::insert(), zmm::String::operator=(), zmm::ObjectStack< Element >::push(), DSOHash< zmm::Array< CacheObject > >::put(), DSBHash< VT >::put(), zmm::ArrayBase::set(), and zmm::String::String().
| void Session::setID | ( | zmm::String | sessionID | ) | [inline] |
Sets the session identifier.
Definition at line 68 of file session_manager.h.
| int Dictionary::size | ( | ) | [inherited] |
Returns the number of elements in the dictinary.
Definition at line 104 of file dictionary.cc.
References Dictionary::elements.
friend class SessionManager [friend] |
Definition at line 111 of file session_manager.h.
mt_atomic_t zmm::Object::_ref_count [protected, inherited] |
Definition at line 54 of file object.h.
Referenced by zmm::Object::getRefCount(), zmm::Object::Object(), zmm::Object::release(), and zmm::Object::retain().
zmm::Ref<zmm::Array<DictionaryElement> > Dictionary::elements [protected, inherited] |
Array of DictionaryElements, representing our Dictionary.
Definition at line 69 of file dictionary.h.
Referenced by Dictionary::_encode(), Dictionary::clear(), Dictionary::clone(), Dictionary::Dictionary(), Dictionary::get(), Dictionary::getElements(), Dictionary::isSubsetOf(), Dictionary::optimize(), Dictionary::put(), Dictionary::remove(), and Dictionary::size().
struct timespec Session::last_access [read, protected] |
time of last access to the session, returned by getLastAccessTime()
Definition at line 104 of file session_manager.h.
Referenced by access(), and getLastAccessTime().
bool Session::loggedIn [protected] |
Definition at line 109 of file session_manager.h.
Referenced by isLoggedIn(), logIn(), logOut(), and Session().
zmm::Ref<Mutex> Dictionary_r::mutex [protected, inherited] |
Reimplemented from zmm::Object.
Definition at line 218 of file dictionary.h.
Referenced by Dictionary_r::clear(), clearUpdateIDs(), Dictionary_r::clone(), containerChangedUI(), Dictionary_r::decode(), Dictionary_r::Dictionary_r(), Dictionary_r::encode(), Dictionary_r::equals(), Dictionary_r::get(), Dictionary_r::getElements(), getUIUpdateIDs(), Dictionary_r::isSubsetOf(), Dictionary_r::optimize(), Dictionary_r::put(), and Dictionary_r::remove().
zmm::String Session::sessionID [protected] |
arbitrary but unique string representing the ID of the session (returned by getID())
Definition at line 107 of file session_manager.h.
long Session::timeout [protected] |
maximum time the session can be idle (starting from last_access)
Definition at line 101 of file session_manager.h.
zmm::Ref<DBRHash<int> > Session::uiUpdateIDs [protected] |
Definition at line 98 of file session_manager.h.
Referenced by clearUpdateIDs(), containerChangedUI(), getUIUpdateIDs(), hasUIUpdateIDs(), and Session().
bool Session::updateAll [protected] |
True if the ui update id hash became to big and the UI shall update every container.
Definition at line 96 of file session_manager.h.
Referenced by clearUpdateIDs(), containerChangedUI(), getUIUpdateIDs(), hasUIUpdateIDs(), and Session().
1.6.1