Parent: [6a85b3] (diff)

Download this file

APN.h    121 lines (101 with data), 3.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#ifndef APN_H_
#define APN_H_
#include <omnetpp.h>
#include <string>
#include <sstream>
/**
* @brief Application Process Name class
*
* @authors Vladimir Vesely (ivesely@fit.vutbr.cz)
* @date Last refactorized and documented on 2014-10-28
*/
class APN
{
public:
/**
* @brief Constructor creating unspecified APN
*/
APN();
/**
* @brief Constructor creating APN of given name
* @param nam Represents APN string name
*/
APN(std::string nam);
/**
* @brief Destructor assigning empty string to name
*/
virtual ~APN();
/**
* @brief Equal operator overloading
* @param other APN for comparison
* @return True if APNs string names are equal, otherwise returns false.
*/
bool operator== (const APN& other) const
{
return !name.compare(other.getName());
}
/**
* @brief Info text output suitable for << string streams and WATCH
* @return APN string name
*/
std::string info() const;
/**
* @brief Gets APN string name representation
* @return APN string
*/
const std::string& getName() const;
/**
* @brief Sets APN string representation to a new value
* @param name New APN string
*/
void setName(const std::string& name);
protected:
/**
* @brief Attribute holding APN name
* APN is basically wrapper around string
*/
std::string name;
};
/**
* @brief APNList represents the list of APNs
* @typedef APNList
*/
typedef std::list<APN> APNList;
/**
* @brief APNList constant iterator
*/
typedef APNList::const_iterator ApnCItem;
/**
* @brief APNList iterator
*/
typedef APNList::iterator ApnItem;
//Free functions
/**
* @brief << operator overload that calls APN.info() method
* @param os Resulting ostream
* @param apn APN class that is being converted to string
* @return Infotext representing APN
*/
std::ostream& operator<< (std::ostream& os, const APN& apn);
/**
* @brief << operator overload that feeds ostream with infotext of all contained APNs.
* @param os Resulting ostream
* @param apns APNList class that is being converted to string
* @return Infotext representing APNList
*/
std::ostream& operator<< (std::ostream& os, const APNList& apns);
#endif /* APN_H_ */