RINASim  October 2016
Documentation of framework for OMNeT++
APNamingInfo.cc
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 #include "APNamingInfo.h"
24 
26  apn(APN()), apinstance(""),
27  aename(""), aeinstance("")
28 {
29 }
30 
31 APNamingInfo::APNamingInfo(APN napn) : apinstance(""), aename(""), aeinstance("")
32 {
33  this->apn = napn;
34 }
35 
36 APNamingInfo::APNamingInfo(APN napn, std::string napinstance,
37  std::string naename, std::string naeinstance) :
38  apn(napn), apinstance(napinstance),
39  aename(naename), aeinstance(naeinstance)
40 {
41 }
42 
44 {
45  this->apn = APN();
46  this->apinstance = "";
47  this->aename = "";
48  this->aeinstance = "";
49 }
50 
51 std::string APNamingInfo::info() const
52 {
53  std::ostringstream os;
54  os << "AP: "<< apn;
55  if (!apinstance.empty())
56  os << " (" << apinstance << ")";
57  if (!aename.empty())
58  os << " AE: " << aename;
59  if (!aeinstance.empty())
60  os << " (" << aeinstance << ")";
61  //os << endl;
62  return os.str();
63 }
64 
65 //Free function
66 std::ostream& operator<< (std::ostream& os, const APNamingInfo& apni)
67 {
68  return os << apni.info();
69 }
70 
72 
74  first = src;
75  second = dst;
76 }
77 
79  first = APNamingInfo();
80  second = APNamingInfo();
81 }
82 
83 APNIPair::APNIPair(const char* src, const char* dst) :
84  APNIPair(APNamingInfo(APN( std::string(src) ) ), APNamingInfo(APN( std::string(dst) ) ))
85 {
86 }
87 
89  first = APNamingInfo();
90  second = APNamingInfo();
91 }
92 
93 std::ostream& operator <<(std::ostream& os, const APNIPair& apnip) {
94  return os << apnip.info();
95 }
96 
97 std::string APNIPair::info() const {
98  std::ostringstream os;
99  os << "SRC> "<< first << "\tDST> " << second;
100  return os.str();
101 }
std::string info() const
Definition: APNamingInfo.cc:97
Application Process Name class.
Definition: APN.h:36
APNamingInfo first
Definition: APNamingInfo.h:200
Register_Class(APNIPair)
std::string apinstance
Optional AP-instance id.
Definition: APNamingInfo.h:163
virtual ~APNamingInfo()
Destructor assigning uninitialized values to APNI.
Definition: APNamingInfo.cc:43
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
virtual ~APNIPair()
Definition: APNamingInfo.cc:88
std::string aename
Optional AE name.
Definition: APNamingInfo.h:168
std::string aeinstance
Optional AE-instance id.
Definition: APNamingInfo.h:173
std::ostream & operator<<(std::ostream &os, const APNamingInfo &apni)
<< operator overload that calls APNI.info() method
Definition: APNamingInfo.cc:66
std::string info() const
Info text output suitable for << string streams and WATCH.
Definition: APNamingInfo.cc:51