INTRODUCTION
Overview
Download and Install
Documentation
Publications
REPOSITORY
Libraries
DEVELOPER
Dev Guide
Dashboard
PEOPLE
Contributors
Users
Project
Download
Mailing lists
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
src
gbxserialacfr
lockfile
lockfile.h
1
/*
2
* GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3
* http://gearbox.sf.net/
4
* Copyright (c) 2004-2010 Alex Brooks
5
*
6
* This distribution is licensed to you under the terms described in
7
* the LICENSE file included in this distribution.
8
*
9
*/
10
#ifndef GBXSERIALACFR_LOCKFILE_H
11
#define GBXSERIALACFR_LOCKFILE_H
12
13
#include <unistd.h>
14
#include <exception>
15
#include <string>
16
17
namespace
gbxserialacfr {
18
namespace
lockfile {
19
23
class
LockFileException
:
public
std::exception
24
{
25
std::string message_;
26
public
:
27
LockFileException
(
const
std::string &message )
28
: message_(message) {}
29
~
LockFileException
()
throw
(){}
30
virtual
const
char
* what()
const
throw
() {
return
message_.c_str(); }
31
};
32
36
class
LockedByOtherProcessException
:
public
LockFileException
37
{
38
public
:
39
LockedByOtherProcessException
(
const
std::string &message )
40
:
LockFileException
(message) {}
41
~
LockedByOtherProcessException
()
throw
(){}
42
};
43
57
class
LockFile
{
58
public
:
59
60
LockFile
(
const
std::string &dev,
61
int
lockPid = getpid() );
62
~
LockFile
();
63
64
private
:
65
66
const
std::string dev_;
67
const
int
lockPid_;
68
69
};
70
71
}
72
}
73
#endif
Generated for GearBox by
1.4.5