RINASim  October 2016
Documentation of framework for OMNeT++
Address.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 ADDRESS_H_
24 #define ADDRESS_H_
25 
26 //Standard libraries
27 #include <string>
28 #include <sstream>
29 //RINASim libraries
30 #include "APN.h"
31 #include "DAP.h"
32 
42 class Address {
43  public:
48  Address();
49 
54  Address(std::string composite);
55 
57 
63  Address(const char* ipcaddr, const char* difnam);
64 
68  virtual ~Address();
69 
76  bool operator== (const Address& other) const;
77 
84  bool operator< (const Address& other) const;
85 
90  std::string info() const;
91 
97  bool isUnspecified() const;
98 
103  const APN& getApn() const;
104 
109  const DAP& getDifName() const;
110 
115  void setDifName(const DAP& difName);
116 
121  const APN& getIpcAddress() const;
122 
127  void setIpcAddress(const APN& ipcAddress);
128 
129  protected:
134 
139 
144 };
145 
146 typedef std::list<Address> Addresses;
147 typedef Addresses::const_iterator AddrCItem;
148 typedef Addresses::iterator AddrItem;
149 
150 //Free function
157 std::ostream& operator<< (std::ostream& os, const Address& addr);
158 
165 std::ostream& operator<< (std::ostream& os, const Addresses& dims);
166 
167 #endif /* ADDRESS_H_ */
const DAP & getDifName() const
Getter of common DIF name.
Definition: Address.cc:73
void setDifName(const DAP &difName)
Setter of common DIF name.
Definition: Address.cc:78
std::list< Address > Addresses
Definition: Address.h:146
void setIpcAddress(const APN &ipcAddress)
Setter of IPC Process address which should be unambiguous within DIF.
Definition: Address.cc:124
bool operator==(const Address &other) const
Definition: Address.cc:88
DAP difName
Commong DIF name represented by DAP.
Definition: Address.h:138
Application Process Name class.
Definition: APN.h:36
virtual ~Address()
Destructor assigning default values.
Definition: Address.cc:66
APN ipcAddress
IPC Process address represented by APN.
Definition: Address.h:133
Addresses::iterator AddrItem
Definition: Address.h:148
const APN & getIpcAddress() const
Getter of IPC Process address which should be unambiguous within DIF.
Definition: Address.cc:83
static const Address UNSPECIFIED_ADDRESS
Definition: Address.h:44
std::string info() const
Info text output suitable for << string streams and WATCH.
Definition: Address.cc:106
Addresses::const_iterator AddrCItem
Definition: Address.h:147
bool operator<(const Address &other) const
Definition: Address.cc:95
bool isUnspecified() const
Checks whether a given Address is unspecified which means that it has empty attributes.
Definition: Address.cc:114
std::ostream & operator<<(std::ostream &os, const Address &addr)
<< operator overload that calls Address.info() method
Definition: Address.cc:129
APN apname
Concatenation of IPC Process address and DIF name represented as APN.
Definition: Address.h:143
const APN & getApn() const
Getter of unique APN which is initialized during object construction.
Definition: Address.cc:119
Address()
Constructor of blank Address.
Definition: Address.cc:27
Address class holds IPC Process identification.
Definition: Address.h:42
Distributed Application Process name a.k.a. DAP class.
Definition: DAP.h:34