Parent: [6a85b3] (diff)

Download this file

APNamingInfo.h    184 lines (159 with data), 4.7 kB

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