NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
macaddress.h
Go to the documentation of this file.
1#ifndef MACADDRESS_H
2#define MACADDRESS_H
3
4#include <QRandomGenerator>
5#include <QString>
6#include <QVector>
7
11
12namespace NetSim {
13
16
27public:
29 MACAddress() = default;
30
36 explicit MACAddress(const QVector<quint8> &address);
37
39 QString toString() const;
40
42 QVector<quint8> toArray() const;
43
45 quint64 toInt() const;
46
49
58 bool operator<(const MACAddress &other) const;
59
69 bool operator==(const MACAddress &other) const;
70
71private:
73 QVector<quint8> m_address{QVector<quint8>() << 0 << 0 << 0 << 0 << 0 << 0};
74};
75} // namespace NetSim
76
77#endif // MACADDRESS_H
Represents a Media Access Control (MAC) address.
Definition macaddress.h:26
quint64 toInt() const
Converts the MAC address to an integer format.
Definition macaddress.cpp:22
bool operator<(const MACAddress &other) const
Overload of the less than operator.
Definition macaddress.cpp:42
MACAddress()=default
Default constructor initializing an empty MAC address.
static MACAddress getRandomAddress()
Generates a random MAC address.
Definition macaddress.cpp:33
bool operator==(const MACAddress &other) const
Overload of the equality operator.
Definition macaddress.cpp:46
QVector< quint8 > toArray() const
Converts the MAC address to a byte array.
Definition macaddress.cpp:18
QString toString() const
Converts the MAC address to a string format.
Definition macaddress.cpp:9
Definition logger.h:12