00001
00002
00003 #ifndef UserState_h
00004 #define UserState_h
00005
00006 #include <cc++/config.h>
00007 #include <string>
00008 #include "StateHistory.h"
00009 #include "StateMetaInfo.h"
00010 #include "StateTransClosure.h"
00011
00012 #include "Serializable.h"
00013
00014
00015 using namespace std;
00016
00018 class UserState: public Serializable
00019 {
00020
00021 public:
00022
00026 UserState();
00027
00031 UserState(string statename);
00032
00036 virtual ~UserState() {}
00037
00041 inline string getSession() const { return session_name; }
00042
00046 inline void setSession(string newname) {
00047 this->session_name = newname;
00048 }
00049
00053 inline uint32 getVersion() const { return state_version; }
00054
00058 inline void setVersion(uint32 newversion){
00059 this->state_version = newversion;
00060 }
00061
00065 inline void newVersion() { this->state_version++; }
00066
00070 virtual StateHistory& getHistory() = 0;
00071
00075 virtual StateMetaInfo& getMetaInfo() = 0;
00076
00080 virtual StateTransClosure& getTransClosure() = 0;
00081
00082 private:
00084 string session_name;
00085
00087 uint32 state_version;
00088
00089
00090 private:
00091 friend class boost::serialization::access;
00092 template<class Archive>
00093 void serialize(Archive & ar, const unsigned int version) {
00094 this->pre_serialize(ar, version);
00095 try {
00096 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Serializable);
00097 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00098 }
00099 try {
00100 ar & BOOST_SERIALIZATION_NVP(session_name);
00101 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00102 }
00103 try {
00104 ar & BOOST_SERIALIZATION_NVP(state_version);
00105 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00106 }
00107 this->post_serialize(ar, version);
00108 }
00109
00110 };
00111 BIE_CLASS_EXPORT_KEY(UserState)
00112 #endif