RINASim  October 2016
Documentation of framework for OMNeT++
APN.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 "APN.h"
24 
26 {
27  this->name = "";
28 }
29 
30 APN::APN(std::string nam)
31 {
32  this->setName(nam);
33 }
34 
36 {
37  this->name = "";
38 }
39 
40 const std::string& APN::getName() const
41 {
42  return name;
43 }
44 
45 void APN::setName(const std::string& name)
46 {
47  this->name = name;
48 }
49 
50 std::string APN::info() const
51 {
52  std::ostringstream os;
53  os << this->getName();
54  return os.str();
55 }
56 
57 //Free function
58 std::ostream& operator<< (std::ostream& os, const APN& apn)
59 {
60  return os << apn.info();
61 }
62 
63 std::ostream& operator <<(std::ostream& os, const APNList& apns)
64 {
65  for (ApnCItem it = apns.begin(); it != apns.end(); ++it) {
66  os << *it << " ";
67  }
68  return os;
69 }
APN()
Constructor creating unspecified APN.
Definition: APN.cc:25
Application Process Name class.
Definition: APN.h:36
std::string info() const
Info text output suitable for << string streams and WATCH.
Definition: APN.cc:50
std::list< APN > APNList
APNList represents the list of APNs.
Definition: APN.h:96
std::string name
Attribute holding APN name APN is basically wrapper around string.
Definition: APN.h:88
void setName(const std::string &name)
Sets APN string representation to a new value.
Definition: APN.cc:45
virtual ~APN()
Destructor assigning empty string to name.
Definition: APN.cc:35
APNList::const_iterator ApnCItem
APNList constant iterator.
Definition: APN.h:103
const std::string & getName() const
Gets APN string name representation.
Definition: APN.cc:40
std::ostream & operator<<(std::ostream &os, const APN &apn)
<< operator overload that calls APN.info() method
Definition: APN.cc:58