5 #ifndef _DDS_SESSIONIDFILE_ 6 #define _DDS_SESSIONIDFILE_ 8 #include <boost/filesystem.hpp> 9 #include <boost/uuid/uuid.hpp> 10 #include <boost/uuid/uuid_generators.hpp> 11 #include <boost/uuid/uuid_io.hpp> 23 : m_pathSIDFile(_sidFile)
25 , m_sid(boost::uuids::nil_uuid())
36 m_sid = boost::uuids::random_generator()();
42 return boost::lexical_cast<std::string>(m_sid);
45 void lock(
const boost::uuids::uuid& _sid,
const std::string& _sidFile =
"")
47 if (!_sidFile.empty())
48 m_pathSIDFile = _sidFile;
50 std::ofstream f(m_pathSIDFile.string());
58 if (boost::filesystem::is_regular_file(m_pathSIDFile))
59 boost::filesystem::remove(m_pathSIDFile);
66 if (!boost::filesystem::is_regular_file(m_pathSIDFile))
69 std::ifstream f(m_pathSIDFile.string());
76 boost::filesystem::path m_pathSIDFile;
78 boost::uuids::uuid m_sid;
void unlock()
Definition: SessionIDFile.h:56
~CSessionIDFile()
Definition: SessionIDFile.h:28
Definition: SessionIDFile.h:15
void lock(const boost::uuids::uuid &_sid, const std::string &_sidFile="")
Definition: SessionIDFile.h:45
std::string string()
Definition: SessionIDFile.h:40
boost::uuids::uuid generate()
Definition: SessionIDFile.h:34
CSessionIDFile()
Definition: SessionIDFile.h:18
std::string getLockedSID()
Definition: SessionIDFile.h:64
CSessionIDFile(const std::string &_sidFile)
Definition: SessionIDFile.h:22
Definition: BoostHelper.h:14