summaryrefslogtreecommitdiff
path: root/project2/common/session.h
diff options
context:
space:
mode:
Diffstat (limited to 'project2/common/session.h')
-rw-r--r--project2/common/session.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/project2/common/session.h b/project2/common/session.h
new file mode 100644
index 0000000..7b66db9
--- /dev/null
+++ b/project2/common/session.h
@@ -0,0 +1,33 @@
+#ifndef SESSION_H
+#define SESSION_H
+
+#include <map>
+#include <glibmm/ustring.h>
+#include <boost/intrusive_ptr.hpp>
+#include "intrusivePtrBase.h"
+#include "variables.h"
+#include "exceptions.h"
+
+/// Base class for classes implementing session variable storage
+class Session : public virtual IntrusivePtrBase {
+ public:
+ SimpleMessageException(VariableNotFound);
+ typedef std::map<Glib::ustring, VariableType> Values;
+
+ Session();
+ virtual ~Session() = 0;
+
+ virtual const VariableType & GetValue(const Glib::ustring & name) const = 0;
+ virtual Values GetValuesCopy() const = 0;
+ virtual void SetValue(const Glib::ustring & name, const VariableType & value) = 0;
+ virtual void ClearValue(const Glib::ustring & name) = 0;
+ virtual time_t ExpiryTime() const = 0;
+
+ protected:
+ virtual void ExpiryTime(time_t) = 0;
+ friend class SessionContainer;
+};
+typedef boost::intrusive_ptr<Session> SessionPtr;
+
+#endif
+