INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
lockfile.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef GBXSERIALACFR_LOCKFILE_H 00011 #define GBXSERIALACFR_LOCKFILE_H 00012 00013 #include <exception> 00014 #include <string> 00015 00016 namespace gbxserialacfr { 00017 namespace lockfile { 00018 00022 class LockFileException : public std::exception 00023 { 00024 std::string message_; 00025 public: 00026 LockFileException(const char *message) 00027 : message_(message) {} 00028 LockFileException(const std::string &message) 00029 : message_(message) {} 00030 ~LockFileException()throw(){} 00031 virtual const char* what() const throw() { return message_.c_str(); } 00032 }; 00033 00047 class LockFile { 00048 public: 00049 00050 LockFile( const std::string &dev, 00051 int lockPid = getpid() ); 00052 ~LockFile(); 00053 00054 private: 00055 00056 const std::string dev_; 00057 const int lockPid_; 00058 00059 }; 00060 00061 } 00062 } 00063 #endif |