Switch to unified view

a/src/Common/APNamingInfo.h b/src/Common/APNamingInfo.h
...
...
14
// 
14
// 
15
15
16
#ifndef APNAMINGINFO_H_
16
#ifndef APNAMINGINFO_H_
17
#define APNAMINGINFO_H_
17
#define APNAMINGINFO_H_
18
18
19
//Standard libraries
19
#include <string>
20
#include <string>
20
#include <sstream>
21
#include <sstream>
21
22
23
//RINASim libraries
22
#include "APN.h"
24
#include "APN.h"
23
25
26
/**
27
 * @brief APNamingInfo holds complete naming info for particular application process.
28
 *
29
 * APNI contains for internal properties: APN, AP-instance id,
30
 * AE name, AE-instance id. Only the first one is mandatory, the rest
31
 * is optional.
32
 *
33
 * @authors Vladimir Vesely (ivesely@fit.vutbr.cz)
34
 * @date Last refactorized and documented on 2014-10-28
35
 */
24
class APNamingInfo
36
class APNamingInfo
25
{
37
{
26
  public:
38
  public:
39
    /**
40
     * @brief Constructor of blank APNI
41
     */
27
    APNamingInfo();
42
    APNamingInfo();
43
44
    /**
45
     * @brief Constructor of APNI with only APN initialized
46
     * @param napn New APN
47
     */
28
    APNamingInfo(APN napn);
48
    APNamingInfo(APN napn);
49
50
    /**
51
     * @brief Construcor of fully initialized APNI
52
     * @param napn New APN
53
     * @param napinstance New AP instance identifier
54
     * @param naename New AE identifier
55
     * @param naeinstance New AE instance identifier
56
     */
29
    APNamingInfo(APN napn, std::string napinstance, std::string naename, std::string naeinstance);
57
    APNamingInfo(APN napn, std::string napinstance, std::string naename, std::string naeinstance);
58
59
    /**
60
     * @brief Destructor assigning uninitialized values to APNI.
61
     */
30
    virtual ~APNamingInfo();
62
    virtual ~APNamingInfo();
31
63
64
    /**
65
     * @brief Equal operator overload
66
     * @param other Other APNI to which this one is being compared
67
     * @return Returns true if all APN, AP-instance id, AE name and AE-instance id
68
     *         are equl. Otherwise returns false.
69
     */
32
    bool operator== (const APNamingInfo& other) const {
70
    bool operator== (const APNamingInfo& other) const
71
    {
33
        return (apn == other.apn &&
72
        return (apn == other.apn &&
34
                !apinstance.compare(other.apinstance) &&
73
                !apinstance.compare(other.apinstance) &&
35
                !aename.compare(other.aename) && !aeinstance.compare(other.aeinstance) );
74
                !aename.compare(other.aename) && !aeinstance.compare(other.aeinstance) );
36
    }
75
    }
37
76
77
    /**
78
     * @brief Info text output suitable for << string streams and  WATCH
79
     * @return APNI string representation
80
     */
38
    std::string info() const;
81
    std::string info() const;
39
82
83
    /**
84
     * @brief Getter of AE-instance attribute
85
     * @return AE-instance id value
86
     */
40
    const std::string& getAeinstance() const {
87
    const std::string& getAeinstance() const {
41
        return aeinstance;
88
        return aeinstance;
42
    }
89
    }
90
91
    /**
92
     * @brief Setter of AE-instance attribute
93
     * @param aeinstance A new AE-instance id value
94
     */
43
    void setAeinstance(const std::string& aeinstance) {
95
    void setAeinstance(const std::string& aeinstance) {
44
        this->aeinstance = aeinstance;
96
        this->aeinstance = aeinstance;
45
    }
97
    }
46
98
99
    /**
100
     * @brief Getter of AE name
101
     * @return AE name value
102
     */
47
    const std::string& getAename() const {
103
    const std::string& getAename() const {
48
        return aename;
104
        return aename;
49
    }
105
    }
106
107
    /**
108
     * @brief Setter of AE name attribute
109
     * @param aename A new AE name value
110
     */
50
    void setAename(const std::string& aename) {
111
    void setAename(const std::string& aename) {
51
        this->aename = aename;
112
        this->aename = aename;
52
    }
113
    }
53
114
115
    /**
116
     * @brief Getter of AP-instance id
117
     * @return AP-instance id value
118
     */
54
    const std::string& getApinstance() const {
119
    const std::string& getApinstance() const {
55
        return apinstance;
120
        return apinstance;
56
    }
121
    }
122
123
    /**
124
     * @brief Setter of AP-instance id
125
     * @param apinstance A new AP-instance id value
126
     */
57
    void setApinstance(const std::string& apinstance) {
127
    void setApinstance(const std::string& apinstance) {
58
        this->apinstance = apinstance;
128
        this->apinstance = apinstance;
59
    }
129
    }
60
130
131
    /**
132
     * @brief Getter of APN
133
     * @return APN
134
     */
61
    const APN& getApn() const {
135
    const APN& getApn() const {
62
        return apn;
136
        return apn;
63
    }
137
    }
138
139
    /**
140
     * @brief Setter of APN
141
     * @param apn A new APN value
142
     */
64
    void setApn(const APN& apn) {
143
    void setApn(const APN& apn) {
65
        this->apn = apn;
144
        this->apn = apn;
66
    }
145
    }
67
146
68
  private:
147
  protected:
148
    /**
149
     * @brief Mandatory APN
150
     */
69
    APN apn;
151
    APN apn;
152
153
    /**
154
     * @brief Optional AP-instance id
155
     */
70
    std::string apinstance;
156
    std::string apinstance;
157
158
    /**
159
     * @brief Optional AE name
160
     */
71
    std::string aename;
161
    std::string aename;
162
163
    /**
164
     * @brief Optional AE-instance id
165
     */
72
    std::string aeinstance;
166
    std::string aeinstance;
73
};
167
};
74
168
169
/**
170
 * @brief APNamingInfo is subclassed by APNI for purely estetic purposes
171
 */
172
class APNI: public APNamingInfo {};
173
75
//Free function
174
//Free function
175
/**
176
 * @brief << operator overload that calls APNI.info() method
177
 * @param os Resulting ostream
178
 * @param apni APNI class that is being converted to string
179
 * @return Infotext representing APNI
180
 */
76
std::ostream& operator<< (std::ostream& os, const APNamingInfo& apni);
181
std::ostream& operator<< (std::ostream& os, const APNamingInfo& apni);
77
182
78
#endif /* APNAMINGINFO_H_ */
183
#endif /* APNAMINGINFO_H_ */