Line |
Branch |
Exec |
Source |
1 |
|
|
/***************************************************************************** |
2 |
|
|
* |
3 |
|
|
* $Id$ |
4 |
|
|
* |
5 |
|
|
* Copyright 2010 Richard Hacker (lerichi at gmx dot net) |
6 |
|
|
* |
7 |
|
|
* This file is part of the pdserv library. |
8 |
|
|
* |
9 |
|
|
* The pdserv library is free software: you can redistribute it and/or modify |
10 |
|
|
* it under the terms of the GNU Lesser General Public License as published |
11 |
|
|
* by the Free Software Foundation, either version 3 of the License, or (at |
12 |
|
|
* your option) any later version. |
13 |
|
|
* |
14 |
|
|
* The pdserv library is distributed in the hope that it will be useful, but |
15 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
16 |
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
17 |
|
|
* License for more details. |
18 |
|
|
* |
19 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
20 |
|
|
* along with the pdserv library. If not, see <http://www.gnu.org/licenses/>. |
21 |
|
|
* |
22 |
|
|
*****************************************************************************/ |
23 |
|
|
|
24 |
|
|
#ifndef LIB_SIGNAL |
25 |
|
|
#define LIB_SIGNAL |
26 |
|
|
|
27 |
|
|
#include <set> |
28 |
|
|
#include <commoncpp/thread.h> |
29 |
|
|
|
30 |
|
|
#include "../Signal.h" |
31 |
|
|
#include "../DataType.h" |
32 |
|
|
|
33 |
|
|
namespace PdServ { |
34 |
|
|
class Session; |
35 |
|
|
class SessionTask; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
class Task; |
39 |
|
|
|
40 |
|
✗ |
class Signal: public PdServ::Signal { |
41 |
|
|
public: |
42 |
|
|
Signal( Task *task, |
43 |
|
|
size_t index, |
44 |
|
|
unsigned int decimation, |
45 |
|
|
const char *path, |
46 |
|
|
const PdServ::DataType& dtype, |
47 |
|
|
const void *addr, |
48 |
|
|
size_t ndims = 1, |
49 |
|
|
const size_t *dim = 0); |
50 |
|
|
|
51 |
|
|
const char * const addr; |
52 |
|
|
|
53 |
|
|
static const size_t dataTypeIndex[PdServ::DataType::maxWidth+1]; |
54 |
|
|
// const PdServ::DataType& dataType; |
55 |
|
|
const size_t index; |
56 |
|
|
|
57 |
|
|
private: |
58 |
|
|
Task * const task; |
59 |
|
|
|
60 |
|
|
mutable ost::Semaphore mutex; |
61 |
|
|
|
62 |
|
|
typedef std::set<const PdServ::SessionTask*> SessionSet; |
63 |
|
|
mutable SessionSet sessions; |
64 |
|
|
|
65 |
|
|
|
66 |
|
|
// Reimplemented from PdServ::Signal |
67 |
|
|
void subscribe(PdServ::SessionTask *) const; |
68 |
|
|
void unsubscribe(PdServ::SessionTask *) const; |
69 |
|
|
double sampleTime() const; |
70 |
|
|
double poll(const PdServ::Session *s, |
71 |
|
|
void *buf, struct timespec *t) const; |
72 |
|
|
const char *getValue(const PdServ::SessionTask*) const; |
73 |
|
|
|
74 |
|
|
// Reimplemented from PdServ::Variable |
75 |
|
|
void getValue(const PdServ::Session*, |
76 |
|
|
void *, struct timespec * = 0) const; |
77 |
|
|
}; |
78 |
|
|
|
79 |
|
|
#endif //LIB_SIGNAL |
80 |
|
|
|