pion-net  4.0.9
common/include/pion/PionAdminRights.hpp
00001 // -----------------------------------------------------------------------
00002 // pion-common: a collection of common libraries used by the Pion Platform
00003 // -----------------------------------------------------------------------
00004 // Copyright (C) 2007-2008 Atomic Labs, Inc.  (http://www.atomiclabs.com)
00005 //
00006 // Distributed under the Boost Software License, Version 1.0.
00007 // See http://www.boost.org/LICENSE_1_0.txt
00008 //
00009 
00010 #ifndef __PION_PIONADMINRIGHTS_HEADER__
00011 #define __PION_PIONADMINRIGHTS_HEADER__
00012 
00013 #include <pion/PionConfig.hpp>
00014 #include <pion/PionLogger.hpp>
00015 #include <boost/cstdint.hpp>
00016 #include <boost/thread/mutex.hpp>
00017 
00018 
00019 namespace pion {    // begin namespace pion
00020 
00021 
00025 class PION_COMMON_API PionAdminRights {
00026 public:
00027 
00034     PionAdminRights(bool use_log = true);
00035 
00037     virtual ~PionAdminRights() { release(); }
00038 
00040     void release(void);
00041 
00042 
00043 private:
00044 
00046     static const boost::int16_t         ADMIN_USER_ID;
00047 
00049     static boost::mutex                 m_mutex;
00050 
00052     PionLogger                          m_logger;
00053 
00055     boost::unique_lock<boost::mutex>    m_lock;
00056 
00058     boost::int16_t                      m_user_id;
00059 
00061     bool                                m_has_rights;
00062 
00064     bool                                m_use_log;
00065 };
00066 
00067 
00068 }   // end namespace pion
00069 
00070 #endif
00071