libDwm-0.9.45
DwmMplsLabelStack.hh
Go to the documentation of this file.
1//===========================================================================
2// @(#) $DwmPath$
3//===========================================================================
4// Copyright (c) Daniel W. McRobb 2007, 2016, 2020, 2024
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions
9// are met:
10//
11// 1. Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13// 2. Redistributions in binary form must reproduce the above copyright
14// notice, this list of conditions and the following disclaimer in the
15// documentation and/or other materials provided with the distribution.
16// 3. The names of the authors and copyright holders may not be used to
17// endorse or promote products derived from this software without
18// specific prior written permission.
19//
20// IN NO EVENT SHALL DANIEL W. MCROBB BE LIABLE TO ANY PARTY FOR
21// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
22// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE,
23// EVEN IF DANIEL W. MCROBB HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
24// DAMAGE.
25//
26// THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND
27// DANIEL W. MCROBB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
28// UPDATES, ENHANCEMENTS, OR MODIFICATIONS. DANIEL W. MCROBB MAKES NO
29// REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER
30// IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31// WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
32// OR THAT THE USE OF THIS SOFTWARE WILL NOT INFRINGE ANY PATENT,
33// TRADEMARK OR OTHER RIGHTS.
34//===========================================================================
35
36//---------------------------------------------------------------------------
40//---------------------------------------------------------------------------
41
42#ifndef _DWMMPLSLABELSTACK_HH_
43#define _DWMMPLSLABELSTACK_HH_
44
45#include <vector>
46
47#include "DwmMplsLabel.hh"
48
49namespace Dwm {
50
51 //--------------------------------------------------------------------------
53 //--------------------------------------------------------------------------
55 {
56 public:
57 //------------------------------------------------------------------------
59 //------------------------------------------------------------------------
60 const std::vector<MplsLabel> & Labels() const;
61
62 //------------------------------------------------------------------------
64 //------------------------------------------------------------------------
65 std::vector<MplsLabel> & Labels();
66
67 //------------------------------------------------------------------------
69 //------------------------------------------------------------------------
70 bool operator == (const MplsLabelStack & labelStack) const;
71
72 //------------------------------------------------------------------------
74 //------------------------------------------------------------------------
75 std::istream & Read(std::istream & is);
76
77 //------------------------------------------------------------------------
79 //------------------------------------------------------------------------
80 std::ostream & Write(std::ostream & os) const;
81
82 //------------------------------------------------------------------------
85 //------------------------------------------------------------------------
86 ssize_t Read(int fd);
87
88 //------------------------------------------------------------------------
91 //------------------------------------------------------------------------
92 ssize_t Write(int fd) const;
93
94 //------------------------------------------------------------------------
97 //------------------------------------------------------------------------
98 size_t Read(FILE *f);
99
100 //------------------------------------------------------------------------
103 //------------------------------------------------------------------------
104 size_t Write(FILE *f) const;
105
106 //------------------------------------------------------------------------
109 //------------------------------------------------------------------------
110 int Read(gzFile gzf);
111
112 //------------------------------------------------------------------------
115 //------------------------------------------------------------------------
116 int Write(gzFile gzf) const;
117
118 //------------------------------------------------------------------------
121 //------------------------------------------------------------------------
122 int BZRead(BZFILE *bzf);
123
124 //------------------------------------------------------------------------
127 //------------------------------------------------------------------------
128 int BZWrite(BZFILE *bzf) const;
129
130 //------------------------------------------------------------------------
133 //------------------------------------------------------------------------
134 uint64_t StreamedLength() const;
135
136 //------------------------------------------------------------------------
138 //------------------------------------------------------------------------
139 friend std::ostream &
140 operator << (std::ostream & os, const MplsLabelStack & labelStack);
141
142 protected:
143 std::vector<MplsLabel> _labels;
144 };
145
146} // namespace Dwm
147
148#endif // _DWMMPLSLABELSTACK_HH_
149
150//---------------------------- emacs settings -----------------------------
151// Local Variables:
152// mode: C++
153// tab-width: 2
154// indent-tabs-mode: nil
155// c-basic-offset: 2
156// End:
157//-------------------------------------------------------------------------
Dwm::MplsLabel class definition.
Encapsulates an MPLS label stack.
Definition DwmMplsLabelStack.hh:55
std::istream & Read(std::istream &is)
Reads the label stack from an istream. Returns the istream.
friend std::ostream & operator<<(std::ostream &os, const MplsLabelStack &labelStack)
Prints the label stack to an ostream in human-readable form.
int BZRead(BZFILE *bzf)
Reads the label stack from the given BZFILE bzf.
ssize_t Write(int fd) const
Writes the label stack to a file descriptor.
int Read(gzFile gzf)
Reads the label stack from the given gzFile gzf.
std::vector< MplsLabel > & Labels()
Returns a mutable reference to the contained MPLS labels.
int BZWrite(BZFILE *bzf) const
Writes the label stack to the given BZFILE bzf.
size_t Write(FILE *f) const
Writes the label stack to a FILE.
int Write(gzFile gzf) const
Writes the label stack to the given gzFile gzf.
bool operator==(const MplsLabelStack &labelStack) const
operator ==
uint64_t StreamedLength() const
Returns the number of bytes that should be written if we call one of the Write() members.
size_t Read(FILE *f)
Reads the label stack from a FILE.
const std::vector< MplsLabel > & Labels() const
Returns a const reference to the contained MPLS labels.
ssize_t Read(int fd)
Reads the label stack from a file descriptor.
std::ostream & Write(std::ostream &os) const
Writes the label stack to an ostream. Returns the ostream.