Statistics
| Branch: | Tag: | Revision:

dvbd / src / recording.h @ 59be6a47

History | View | Annotate | Download (2.32 KB)

1
// -*- c++ -*-
2
/*
3
  Copyright 2003 John Knottenbelt
4
  
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
7
  the Free Software Foundation; either version 2 of the License, or
8
  (at your option) any later version.
9
 
10
  This program is distributed in the hope that it will be useful,
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
  GNU General Public License for more details.
14
 
15
  You should have received a copy of the GNU General Public License
16
  along with this program; if not, write to the Free Software
17
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
18
*/
19

    
20
#if !defined __RECORDING_H
21

    
22
#include "stringrep.h"
23
#include <string>
24
#include <ctime>
25
#include <iostream>
26

    
27
/** Represents a scheduled recording */
28

    
29
class Recording : public StringRep {
30
public:
31
  Recording()
32
    : job(-1), priority(-1), duration(0), uid(0)
33
  {
34
  }
35

    
36
  Recording(const std::string &type,
37
            const std::string &channel,
38
            bool convertToPS,
39
            int priority,
40
            time_t startTime,
41
            unsigned duration,
42
            const std::string &path,
43
            uid_t uid)
44
    : job(-1),
45
      type(type), channel(channel),
46
      convertToPS(convertToPS),
47
      priority(priority), startTime(startTime),
48
      duration(duration), path(path), 
49
      uid(uid)
50
  {
51
  }
52

    
53
  ~Recording();
54

    
55
  void setJob(int job) {
56
    this->job = job;
57
  }
58

    
59
  int getJob() const {
60
    return job;
61
  }
62

    
63
  std::string getType() const {
64
    return type;
65
  }
66

    
67
  std::string getChannel() const {
68
    return channel;
69
  }
70

    
71
  bool getConvertToPS() const {
72
    return convertToPS;
73
  }
74

    
75
  int getPriority() const {
76
    return priority;
77
  }
78

    
79
  time_t getStartTime() const {
80
    return startTime;
81
  }
82

    
83
  unsigned getDuration() const {
84
    return duration;
85
  }
86

    
87
  time_t getStopTime() const {
88
    return startTime + duration;
89
  }
90

    
91
  std::string getPath() const {
92
    return path;
93
  }
94

    
95
  uid_t getUid() const {
96
    return uid;
97
  }
98

    
99
  friend std::istream &operator >> (std::istream &i, Recording &r);
100

    
101
protected:
102

    
103
  virtual std::ostream& printOn(std::ostream &) const;
104

    
105
private:
106
  int job;
107
  std::string type, channel;
108
  bool convertToPS;
109
  int priority; 
110
  time_t startTime;
111
  unsigned duration;
112
  std::string path;
113
  int uid;
114
};
115

    
116
#endif // __RECORDING_H