libDwm-0.6.0
DwmMplsLabelStack.hh
Go to the documentation of this file.
1 //===========================================================================
2 // @(#) $DwmPath: dwm/libDwm/tags/libDwm-0.6.0/include/DwmMplsLabelStack.hh 8401 $
3 // @(#) $Id: DwmMplsLabelStack.hh 8401 2016-04-17 06:44:31Z dwm $
4 //===========================================================================
5 // Copyright (c) Daniel W. McRobb 2007, 2016
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // 1. Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // 2. Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // 3. The names of the authors and copyright holders may not be used to
18 // endorse or promote products derived from this software without
19 // specific prior written permission.
20 //
21 // IN NO EVENT SHALL DANIEL W. MCROBB BE LIABLE TO ANY PARTY FOR
22 // DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
23 // INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE,
24 // EVEN IF DANIEL W. MCROBB HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
25 // DAMAGE.
26 //
27 // THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND
28 // DANIEL W. MCROBB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
29 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. DANIEL W. MCROBB MAKES NO
30 // REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER
31 // IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 // WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
33 // OR THAT THE USE OF THIS SOFTWARE WILL NOT INFRINGE ANY PATENT,
34 // TRADEMARK OR OTHER RIGHTS.
35 //===========================================================================
36 
37 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
41 
42 #ifndef _DWMMPLSLABELSTACK_HH_
43 #define _DWMMPLSLABELSTACK_HH_
44 
45 #include <vector>
46 
47 #include "DwmMplsLabel.hh"
48 
49 namespace Dwm {
50 
51  //--------------------------------------------------------------------------
53  //--------------------------------------------------------------------------
55  : public Readable, public Writable,
56  public GZReadable, public GZWritable,
57  public BZ2Readable, public BZ2Writable
58  {
59  public:
60  //------------------------------------------------------------------------
62  //------------------------------------------------------------------------
63  const std::vector<MplsLabel> & Labels() const;
64 
65  //------------------------------------------------------------------------
67  //------------------------------------------------------------------------
68  std::vector<MplsLabel> & Labels();
69 
70  //------------------------------------------------------------------------
72  //------------------------------------------------------------------------
73  bool operator == (const MplsLabelStack & labelStack) const;
74 
75  //------------------------------------------------------------------------
77  //------------------------------------------------------------------------
78  std::istream & Read(std::istream & is);
79 
80  //------------------------------------------------------------------------
82  //------------------------------------------------------------------------
83  std::ostream & Write(std::ostream & os) const;
84 
85  //------------------------------------------------------------------------
88  //------------------------------------------------------------------------
89  ssize_t Read(int fd);
90 
91  //------------------------------------------------------------------------
94  //------------------------------------------------------------------------
95  ssize_t Write(int fd) const;
96 
97  //------------------------------------------------------------------------
100  //------------------------------------------------------------------------
101  size_t Read(FILE *f);
102 
103  //------------------------------------------------------------------------
106  //------------------------------------------------------------------------
107  size_t Write(FILE *f) const;
108 
109  //------------------------------------------------------------------------
112  //------------------------------------------------------------------------
113  int Read(gzFile gzf);
114 
115  //------------------------------------------------------------------------
118  //------------------------------------------------------------------------
119  int Write(gzFile gzf) const;
120 
121  //------------------------------------------------------------------------
124  //------------------------------------------------------------------------
125  int BZRead(BZFILE *bzf);
126 
127  //------------------------------------------------------------------------
130  //------------------------------------------------------------------------
131  int BZWrite(BZFILE *bzf) const;
132 
133  //------------------------------------------------------------------------
136  //------------------------------------------------------------------------
137  uint32_t StreamedLength() const;
138 
139  //------------------------------------------------------------------------
141  //------------------------------------------------------------------------
142  friend std::ostream &
143  operator << (std::ostream & os, const MplsLabelStack & labelStack);
144 
145  protected:
146  std::vector<MplsLabel> _labels;
147  };
148 
149 } // namespace Dwm
150 
151 #endif // _DWMMPLSLABELSTACK_HH_
152 
153 //---------------------------- emacs settings -----------------------------
154 // Local Variables:
155 // mode: C++/la
156 // tab-width: 2
157 // indent-tabs-mode: nil
158 // c-basic-offset: 2
159 // End:
160 //-------------------------------------------------------------------------
This class is a pure virtual class, defining an interface for classes that can write their contents t...
Definition: DwmGZWritable.hh:57
std::istream & Read(std::istream &is)
Reads the label stack from an istream. Returns the istream.
This class is a pure virtual class, defining an interface for classes that can read their contents fr...
Definition: DwmBZ2Readable.hh:57
uint32_t StreamedLength() const
Returns the number of bytes that should be written if we call one of the Write() members.
Dwm::MplsLabel class definition.
friend std::ostream & operator<<(std::ostream &os, const MplsLabelStack &labelStack)
Prints the label stack to an ostream in human-readable form.
const std::vector< MplsLabel > & Labels() const
Returns a const reference to the contained MPLS labels.
Definition: DwmBZ2IO.hh:67
int BZWrite(BZFILE *bzf) const
Writes the label stack to the given BZFILE bzf.
std::ostream & Write(std::ostream &os) const
Writes the label stack to an ostream. Returns the ostream.
This class is a pure virtual class, defining an interface for classes that can read their contents fr...
Definition: DwmGZReadable.hh:57
bool operator==(const MplsLabelStack &labelStack) const
operator ==
Encapsulates an MPLS label stack.
Definition: DwmMplsLabelStack.hh:54
This class defines an interface for classes that can write their contents to an ostream, file descriptor or FILE pointer.
Definition: DwmWritable.hh:58
This class is a pure virtual class, defining an interface for classes that can write their contents t...
Definition: DwmBZ2Writable.hh:57
This class defines an interface for classes that can read their contents from an istream, file descriptor or FILE pointer.
Definition: DwmReadable.hh:58
int BZRead(BZFILE *bzf)
Reads the label stack from the given BZFILE bzf.