RINASim  October 2016
Documentation of framework for OMNeT++
APN.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 APN_H_
24 #define APN_H_
25 
26 #include <omnetpp.h>
27 #include <string>
28 #include <sstream>
29 
36 class APN
37 {
38  public:
42  APN();
43 
48  APN(std::string nam);
49 
53  virtual ~APN();
54 
60  bool operator== (const APN& other) const
61  {
62  return !name.compare(other.getName());
63  }
64 
69  std::string info() const;
70 
75  const std::string& getName() const;
76 
81  void setName(const std::string& name);
82 
83  protected:
88  std::string name;
89 
90 };
91 
96 typedef std::list<APN> APNList;
97 
98 
103 typedef APNList::const_iterator ApnCItem;
104 
109 typedef APNList::iterator ApnItem;
110 
111 //Free functions
112 
119 std::ostream& operator<< (std::ostream& os, const APN& apn);
120 
127 std::ostream& operator<< (std::ostream& os, const APNList& apns);
128 
129 #endif /* APN_H_ */
std::ostream & operator<<(std::ostream &os, const APN &apn)
<< operator overload that calls APN.info() method
Definition: APN.cc:58
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::iterator ApnItem
APNList iterator.
Definition: APN.h:109
APNList::const_iterator ApnCItem
APNList constant iterator.
Definition: APN.h:103
bool operator==(const APN &other) const
Equal operator overloading.
Definition: APN.h:60
const std::string & getName() const
Gets APN string name representation.
Definition: APN.cc:40