Dynamic lib selection and deployment
[anna.git] / example / diameter / launcher / testing / TestCondition.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #ifndef example_diameter_launcher_TestCondition_hpp
10 #define example_diameter_launcher_TestCondition_hpp
11
12 // Standard
13 #include <string>
14
15 // Project
16 #include <anna/core/DataBlock.hpp>
17
18
19 namespace anna {
20   namespace xml {
21     class Node;
22   }
23 }
24
25
26 class TestCondition {
27
28   public:
29
30     struct Type { enum _v { Generic, Basic }; };
31     static const char* asText(const Type::_v type) throw();
32
33     TestCondition() : a_rcvFromEntity(true),
34                       a_regexp(""),
35                       a_code(""), a_bitR(""), a_hopByHop(""), a_applicationId(""),
36                       a_sessionId(""), a_resultCode(""),
37                       a_msisdn(""), a_imsi(""), a_serviceContextId("") { a_type = Type::Basic; }
38
39
40     // Source of the received message
41     void setReceivedFromEntity(bool rfe) throw() { a_rcvFromEntity = rfe; }
42     bool receivedFromEntity() const throw() { return a_rcvFromEntity; }
43
44     // Generic
45     void setRegexp(const std::string &regexp) throw() { a_regexp = regexp; }
46     // Basic
47     void setCode(const std::string &value) throw() { a_code = value; }
48     void setBitR(const std::string &value) throw() { a_bitR = value; }
49     void setHopByHop(const std::string &value) throw() { a_hopByHop = value; }
50     void setApplicationId(const std::string &value) throw() { a_applicationId = value; }
51     void setSessionId(const std::string &value) throw() { a_sessionId = value; }
52     void setResultCode(const std::string &value) throw() { a_resultCode = value; }
53     void setMsisdn(const std::string &value) throw() { a_msisdn = value; }
54     void setImsi(const std::string &value) throw() { a_imsi = value; }
55     void setServiceContextId(const std::string &value) throw() { a_serviceContextId = value; }
56
57     bool exists() const throw();
58     friend bool operator==(const TestCondition &c1, const TestCondition &c2) throw();
59
60     // Generic
61     const std::string & getRegexp() const throw() { return a_regexp; }
62     // Basic
63     const std::string & getCode() const throw() { return a_code; }
64     const std::string & getBitR() const throw() { return a_bitR; }
65     const std::string & getHopByHop() const throw() { return a_hopByHop; }
66     const std::string & getApplicationId() const throw() { return a_applicationId; }
67     const std::string & getSessionId() const throw() { return a_sessionId; }
68     const std::string & getResultCode() const throw() { return a_resultCode; }
69     const std::string & getMsisdn() const throw() { return a_msisdn; }
70     const std::string & getImsi() const throw() { return a_imsi; }
71     const std::string & getServiceContextId() const throw() { return a_serviceContextId; }
72
73
74     bool comply (const anna::DataBlock &message/*, bool matchSessionId*/) const throw();
75
76
77     anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
78
79
80   private:
81
82     // Source of the received message
83     bool a_rcvFromEntity;
84
85     // Type
86     Type::_v a_type;
87
88     // Generic:
89     std::string a_regexp;
90
91     // Basic:
92     std::string a_code;
93     std::string a_bitR;
94     std::string a_hopByHop;
95     std::string a_applicationId;
96     std::string a_sessionId;
97     std::string a_resultCode;
98     std::string a_msisdn;
99     std::string a_imsi;
100     std::string a_serviceContextId;
101 };
102
103
104 #endif