1
// ---------------------------------------------------------------------------
3
// - afnix:csm module - slot class definition -
4
// ---------------------------------------------------------------------------
5
// - This program is free software; you can redistribute it and/or modify -
6
// - it provided that this copyright notice is kept intact. -
8
// - This program is distributed in the hope that it will be useful, but -
9
// - without any warranty; without even the implied warranty of -
10
// - merchantability or fitness for a particular purpose. In no event shall -
11
// - the copyright holder be liable for any direct, indirect, incidental or -
12
// - special damages arising in any way out of the use of this software. -
13
// ---------------------------------------------------------------------------
14
// - copyright (c) 1999-2012 amaury darsch -
15
// ---------------------------------------------------------------------------
17
#ifndef AFNIX_SLOT_HPP
18
#define AFNIX_SLOT_HPP
20
#ifndef AFNIX_STRING_HPP
26
/// The Slot class is a base class design to handle a basic time slot
27
/// event. The class is defined with a date and a duration. Various class
28
/// can be derived from it such like the appointment. The slot class
29
/// is primarily used to build an agenda.
30
/// @author amaury darsch
32
class Slot : public virtual Object {
42
/// create a default slot
45
/// create a slot by time and duration
46
/// @param time the slot time
47
/// @param dlen the duration time
48
Slot (const t_long time, const t_long dlen);
50
/// copy construct this slot
51
/// @param that the slot to copy
52
Slot (const Slot& that);
54
/// @return the class name
55
String repr (void) const;
57
/// assign a slot to this one
58
/// @param that the slot to assign
59
Slot& operator = (const Slot& that);
62
virtual void reset (void);
65
/// @param time the slot time to set
66
virtual void settime (const t_long time);
68
/// @return the slot time
69
virtual t_long gettime (void) const;
71
/// set the slot duration
72
/// @param dlen the duration time to set
73
virtual void setdlen (const t_long dlen);
75
/// @return the slot duration
76
virtual t_long getdlen (void) const;
78
/// set the slot at once
79
/// @param time the slot time to set
80
/// @param dlen the duration time to set
81
virtual void setslot (const t_long time, const t_long dlen);
83
/// set the slot index
84
/// @param sidx the slot index to set
85
virtual void setsidx (const long sidx);
87
/// @return the slot index
88
virtual long getsidx (void) const;
90
/// @return true if the slot matches in time and duration
91
/// @param slot the slot to match
92
virtual bool match (const Slot& slot) const;
95
/// create a object in a generic way
96
/// @param argv the argument vector
97
static Object* mknew (Vector* argv);
99
/// @return true if the given quark is defined
100
bool isquark (const long quark, const bool hflg) const;
102
/// apply this object with a set of arguments and a quark
103
/// @param robj the current runnable
104
/// @param nset the current nameset
105
/// @param quark the quark to apply these arguments
106
/// @param argv the arguments to apply
107
Object* apply (Runnable* robj, Nameset* nset, const long quark,