5 #ifndef __DDS__SESSIONIDFILE__ 6 #define __DDS__SESSIONIDFILE__ 8 #include <boost/filesystem.hpp> 9 #pragma clang diagnostic push 10 #pragma clang diagnostic ignored "-Wdeprecated-register" 11 #include <boost/uuid/uuid.hpp> 12 #include <boost/uuid/uuid_generators.hpp> 13 #include <boost/uuid/uuid_io.hpp> 14 #pragma clang diagnostic pop 26 : m_pathSIDFile(_sidFile)
28 , m_sid(boost::uuids::nil_uuid())
39 m_sid = boost::uuids::random_generator()();
45 return boost::lexical_cast<std::string>(m_sid);
48 void lock(
const boost::uuids::uuid& _sid,
const std::string& _sidFile =
"")
50 if (!_sidFile.empty())
51 m_pathSIDFile = _sidFile;
53 std::ofstream f(m_pathSIDFile.string());
61 if (boost::filesystem::is_regular_file(m_pathSIDFile))
62 boost::filesystem::remove(m_pathSIDFile);
69 if (!boost::filesystem::is_regular_file(m_pathSIDFile))
72 std::ifstream f(m_pathSIDFile.string());
79 boost::filesystem::path m_pathSIDFile;
81 boost::uuids::uuid m_sid;
CSessionIDFile()
Definition: SessionIDFile.h:21
std::string string()
Definition: SessionIDFile.h:43
boost::uuids::uuid generate()
Definition: SessionIDFile.h:37
CSessionIDFile(const std::string &_sidFile)
Definition: SessionIDFile.h:25
void lock(const boost::uuids::uuid &_sid, const std::string &_sidFile="")
Definition: SessionIDFile.h:48
std::string getLockedSID()
Definition: SessionIDFile.h:67
void unlock()
Definition: SessionIDFile.h:59
Definition: SessionIDFile.h:18
~CSessionIDFile()
Definition: SessionIDFile.h:31
Miscellaneous functions and helpers are located here.
Definition: BOOST_FILESYSTEM.h:21