RINASim  October 2016
Documentation of framework for OMNeT++
APNamingInfo.h
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #ifndef APNAMINGINFO_H_
24 #define APNAMINGINFO_H_
25 
26 //Standard libraries
27 #include <string>
28 #include <sstream>
29 
30 //RINASim libraries
31 #include "APN.h"
32 
44 {
45  public:
49  APNamingInfo();
50 
55  APNamingInfo(APN napn);
56 
64  APNamingInfo(APN napn, std::string napinstance, std::string naename, std::string naeinstance);
65 
69  virtual ~APNamingInfo();
70 
77  bool operator== (const APNamingInfo& other) const
78  {
79  return (apn == other.apn &&
80  !apinstance.compare(other.apinstance) &&
81  !aename.compare(other.aename) && !aeinstance.compare(other.aeinstance) );
82  }
83 
88  std::string info() const;
89 
94  const std::string& getAeinstance() const {
95  return aeinstance;
96  }
97 
102  void setAeinstance(const std::string& aeinstance) {
103  this->aeinstance = aeinstance;
104  }
105 
110  const std::string& getAename() const {
111  return aename;
112  }
113 
118  void setAename(const std::string& aename) {
119  this->aename = aename;
120  }
121 
126  const std::string& getApinstance() const {
127  return apinstance;
128  }
129 
134  void setApinstance(const std::string& apinstance) {
135  this->apinstance = apinstance;
136  }
137 
142  const APN& getApn() const {
143  return apn;
144  }
145 
150  void setApn(const APN& apn) {
151  this->apn = apn;
152  }
153 
154  protected:
159 
163  std::string apinstance;
164 
168  std::string aename;
169 
173  std::string aeinstance;
174 };
175 
179 class APNI: public APNamingInfo {};
180 
181 //Free function
188 std::ostream& operator<< (std::ostream& os, const APNamingInfo& apni);
189 
190 class APNIPair : public cObject
191 {
192  public:
193  APNIPair();
195  APNIPair(const char* src, const char* dst);
196  virtual ~APNIPair();
197 
198  std::string info() const;
199 
202 
203 };
204 
205 std::ostream& operator<< (std::ostream& os, const APNIPair& apnip);
206 
207 #endif /* APNAMINGINFO_H_ */
std::string info() const
Definition: APNamingInfo.cc:97
void setApinstance(const std::string &apinstance)
Setter of AP-instance id.
Definition: APNamingInfo.h:134
Application Process Name class.
Definition: APN.h:36
void setAename(const std::string &aename)
Setter of AE name attribute.
Definition: APNamingInfo.h:118
APNamingInfo first
Definition: APNamingInfo.h:200
void setApn(const APN &apn)
Setter of APN.
Definition: APNamingInfo.h:150
APNamingInfo is subclassed by APNI for purely estetic purposes.
Definition: APNamingInfo.h:179
void setAeinstance(const std::string &aeinstance)
Setter of AE-instance attribute.
Definition: APNamingInfo.h:102
const std::string & getAename() const
Getter of AE name.
Definition: APNamingInfo.h:110
std::string apinstance
Optional AP-instance id.
Definition: APNamingInfo.h:163
virtual ~APNamingInfo()
Destructor assigning uninitialized values to APNI.
Definition: APNamingInfo.cc:43
const APN & getApn() const
Getter of APN.
Definition: APNamingInfo.h:142
APN apn
Mandatory APN.
Definition: APNamingInfo.h:158
APNamingInfo second
Definition: APNamingInfo.h:201
APNamingInfo()
Constructor of blank APNI.
Definition: APNamingInfo.cc:25
APNamingInfo holds complete naming info for particular application process.
Definition: APNamingInfo.h:43
std::ostream & operator<<(std::ostream &os, const APNamingInfo &apni)
<< operator overload that calls APNI.info() method
Definition: APNamingInfo.cc:66
virtual ~APNIPair()
Definition: APNamingInfo.cc:88
const std::string & getAeinstance() const
Getter of AE-instance attribute.
Definition: APNamingInfo.h:94
const std::string & getApinstance() const
Getter of AP-instance id.
Definition: APNamingInfo.h:126
std::string aename
Optional AE name.
Definition: APNamingInfo.h:168
std::string aeinstance
Optional AE-instance id.
Definition: APNamingInfo.h:173
bool operator==(const APNamingInfo &other) const
Equal operator overload.
Definition: APNamingInfo.h:77
std::string info() const
Info text output suitable for << string streams and WATCH.
Definition: APNamingInfo.cc:51