Muster SDK  8.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MTimeRule.h
Go to the documentation of this file.
1 /*****************************************************************************
2  **
3  ** Header file for Muster API Time rule object lib
4  **
5  ** Name : MTimeRule.h
6  ** Author : Leonardo Bernardini
7  ** Version : 1.0, Sat Mar 2nd 2013
8  **
9  ** Copyright 2000-2014, Virtual Vertex
10  ** All Rights Reserved.
11  **
12  ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13  ** The contents of this file may not be disclosed to third parties, copied
14  ** or duplicated in any form, in whole or in part, without the prior written
15  ** permission of the author.
16  **
17  *****************************************************************************/
18 #ifndef MTIMERULE_H
19 #define MTIMERULE_H
20 
21 #ifdef WIN32
22 // Windows definitions
23 #ifdef MCLIENTLIB_EXPORTS
24 #define MCLIENTLIB_API __declspec(dllexport)
25 #else
26 #define MCLIENTLIB_API __declspec(dllimport)
27 #endif
28 #else
29 
30 #ifndef MCLIENTLIB_EXPORTS
31 #ifdef LINUX
32 #define MCLIENTLIB_API
33 #else
34 #define MCLIENTLIB_API
35 #endif
36 #else
37 #define MCLIENTLIB_API
38 #endif
39 #endif
40 
41 // Disable STL Export warning, member is private, we don't need direct access from the DLL client
42 #if defined(_WIN32)
43 #pragma warning(disable: 4251)
44 #endif // _WIN32
45 
46 #include <string>
47 #include <vector>
48 #include <list>
49 
50 namespace MClientLib {
51 
56  private:
57  int type;
58  int availability;
59  long long int startingTime;
60  long long int endingTime;
61 
62 
63  public:
64 
68  kTimeRuleNotPertinent
69  };
70 
73  kTimeRuleTimeSpan
74  };
75 
78  kTimeRuleAvailable
79  };
80 
81  MTimeRule();
82  void setType(int ruleType);
83  int getType();
84 
85  void setAvailability(int ruleAvailability);
86  int getAvailability();
87 
88  void getRuleTimeSpan(long long int& _startingTime, long long int& _endingTime);
89  void setRuleTimeSpan(long long int _startingTime, long long int _endingTime);
90  void setRuleDayRange(int startingDay, int startingHour, int startingMinutes,
91  int endingDay,int endingHours, int endingMinutes);
92  void getRuleDayRange(int& startingDay, int& startingHour, int& startingMinutes,
93  int& endingDay,int& endingHours, int& endingMinutes);
94 
95  static std::vector<MTimeRule> Unmarshall(const std::string& );
96  static std::string Marshall(const std::vector<MTimeRule>& list);
97 
98 #ifndef SWIG
99  void encodeTree(void* _pt, std::string (*encodeFunc)(const std::string &),int encoding) const;
100  void decodeTree(void* _pt);
101  int Evaluate() const;
102  static int Evaluate(const std::vector<MTimeRule>& rules,int defaultValue = kTimeRuleNotPertinent);
103  static void encodeTreeList(void* _pt, std::string (*encodeFunc)(const std::string &),int encoding,const std::vector<MTimeRule>& list) ;
104  static std::vector<MTimeRule> decodeTreeList(void* _pt);
105 #endif
106  } ;
107 }
108 
109 #endif