InterfaceDecorator.cci
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief InterfaceDecorator inline non-template implementation */
16 
17 //#include "InterfaceDecorator.ih"
18 
19 // Custom includes
20 
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::emu::ReceiverDecorator
26 
27 prefix_ senf::emu::ReceiverDecorator::~ReceiverDecorator()
28 {}
29 
30 //-/////////////////////////////////////////////////////////////////////////////////////////////////
31 // senf::emu::TransmitterDecorator
32 
33 prefix_ senf::emu::TransmitterDecorator::~TransmitterDecorator()
34 {}
35 
36 //-/////////////////////////////////////////////////////////////////////////////////////////////////
37 // senf::emu::InterfaceDecorator
38 
39 prefix_ senf::emu::InterfaceDecorator::~InterfaceDecorator()
40 {}
41 
42 prefix_ senf::emu::Interface & senf::emu::InterfaceDecorator::interface()
43 {
44  return interface_;
45 }
46 
47 prefix_ senf::emu::Interface const & senf::emu::InterfaceDecorator::interface()
48  const
49 {
50  return interface_;
51 }
52 
53 prefix_ senf::emu::Interface * senf::emu::InterfaceDecorator::operator->()
54 {
55  return &interface_;
56 }
57 
58 prefix_ senf::emu::Interface const * senf::emu::InterfaceDecorator::operator->()
59  const
60 {
61  return &interface_;
62 }
63 
64 prefix_ senf::emu::ReceiverDecorator & senf::emu::InterfaceDecorator::receiverDecorator()
65 {
66  try {
67  return dynamic_cast<ReceiverDecorator &>(*this);
68  }
69  SENF_WRAP_EXC(std::bad_cast)
70 }
71 
72 prefix_ senf::emu::ReceiverDecorator const & senf::emu::InterfaceDecorator::receiverDecorator()
73  const
74 {
75  try {
76  return dynamic_cast<ReceiverDecorator const &>(*this);
77  }
78  SENF_WRAP_EXC(std::bad_cast)
79 }
80 
81 prefix_ senf::emu::TransmitterDecorator & senf::emu::InterfaceDecorator::transmitterDecorator()
82 {
83  try {
84  return dynamic_cast<TransmitterDecorator &>(*this);
85  }
86  SENF_WRAP_EXC(std::bad_cast)
87 }
88 
89 prefix_ senf::emu::TransmitterDecorator const &
90 senf::emu::InterfaceDecorator::transmitterDecorator()
91  const
92 {
93  try {
94  return dynamic_cast<TransmitterDecorator const &>(*this);
95  }
96  SENF_WRAP_EXC(std::bad_cast)
97 }
98 
99 prefix_ bool senf::emu::InterfaceDecorator::canReceive()
100  const
101 {
102  return dynamic_cast<ReceiverDecorator const *>(this);
103 }
104 
105 prefix_ bool senf::emu::InterfaceDecorator::canTransmit()
106  const
107 {
108  return dynamic_cast<TransmitterDecorator const *>(this);
109 }
110 
111 prefix_ senf::emu::InterfaceDecorator::InterfaceDecorator(Interface & interface)
112  : interface_(interface)
113 {}
114 
115 //-/////////////////////////////////////////////////////////////////////////////////////////////////
116 #undef prefix_
117 
118 
119 // Local Variables:
120 // mode: c++
121 // fill-column: 100
122 // comment-column: 40
123 // c-file-style: "senf"
124 // indent-tabs-mode: nil
125 // ispell-local-dictionary: "american"
126 // compile-command: "scons -u test"
127 // End: