INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

lockfile.h

00001 /*
00002  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
00003  *               http://gearbox.sf.net/
00004  * Copyright (c) 2004-2010 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 std::string &message )
00027         : message_(message) {}
00028     ~LockFileException()throw(){}
00029     virtual const char* what() const throw() { return message_.c_str(); }
00030 };
00031 
00035 class LockedByOtherProcessException : public LockFileException
00036 {
00037 public:
00038     LockedByOtherProcessException( const std::string &message )
00039         : LockFileException(message) {}
00040     ~LockedByOtherProcessException()throw(){}
00041 };
00042 
00056 class LockFile {
00057 public:
00058 
00059     LockFile( const std::string &dev,
00060               int lockPid = getpid() );
00061     ~LockFile();
00062 
00063 private:
00064 
00065     const std::string dev_;
00066     const int lockPid_;
00067 
00068 };
00069 
00070 }
00071 }
00072 #endif
 

Generated for GearBox by  doxygen 1.4.5