Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
| 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
| 8 | #ifndef NDN_FORWARDING_FLAGS_HPP |
| 9 | #define NDN_FORWARDING_FLAGS_HPP |
| 10 | |
| 11 | #include "c/forwarding-flags.h" |
| 12 | |
| 13 | namespace ndn { |
| 14 | |
| 15 | /** |
| 16 | * A ForwardingFlags object holds the flags which specify how the forwarding daemon should forward an interest for |
| 17 | * a registered prefix. We use a separate ForwardingFlags object to retain future compatibility if the daemon forwarding |
| 18 | * bits are changed, amended or deprecated. |
| 19 | */ |
| 20 | class ForwardingFlags : public ndn_ForwardingFlags { |
| 21 | public: |
| 22 | /** |
| 23 | * Create a new ForwardingFlags with "active" and "childInherit" set and all other flags cleared. |
| 24 | */ |
| 25 | ForwardingFlags() |
| 26 | { |
| 27 | ndn_ForwardingFlags_initialize(this); |
| 28 | } |
| 29 | |
| 30 | ForwardingFlags(const struct ndn_ForwardingFlags &forwardingFlagsStruct) |
| 31 | : ndn_ForwardingFlags(forwardingFlagsStruct) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Get the value of the "active" flag. |
| 37 | * @return true if the flag is set, false if it is cleared. |
| 38 | */ |
| 39 | bool getActive() const { return active; } |
| 40 | |
| 41 | /** |
| 42 | * Get the value of the "childInherit" flag. |
| 43 | * @return true if the flag is set, false if it is cleared. |
| 44 | */ |
| 45 | bool getChildInherit() const { return childInherit; } |
| 46 | |
| 47 | /** |
| 48 | * Get the value of the "advertise" flag. |
| 49 | * @return true if the flag is set, false if it is cleared. |
| 50 | */ |
| 51 | bool getAdvertise() const { return advertise; } |
| 52 | |
| 53 | /** |
| 54 | * Get the value of the "last" flag. |
| 55 | * @return true if the flag is set, false if it is cleared. |
| 56 | */ |
| 57 | bool getLast() const { return last; } |
| 58 | |
| 59 | /** |
| 60 | * Get the value of the "capture" flag. |
| 61 | * @return true if the flag is set, false if it is cleared. |
| 62 | */ |
| 63 | bool getCapture() const { return capture; } |
| 64 | |
| 65 | /** |
| 66 | * Get the value of the "local" flag. |
| 67 | * @return true if the flag is set, false if it is cleared. |
| 68 | */ |
| 69 | bool getLocal() const { return local; } |
| 70 | |
| 71 | /** |
| 72 | * Get the value of the "tap" flag. |
| 73 | * @return true if the flag is set, false if it is cleared. |
| 74 | */ |
| 75 | bool getTap() const { return tap; } |
| 76 | |
| 77 | /** |
| 78 | * Get the value of the "captureOk" flag. |
| 79 | * @return true if the flag is set, false if it is cleared. |
| 80 | */ |
| 81 | bool getCaptureOk() const { return captureOk; } |
| 82 | |
| 83 | /** |
| 84 | * Set the value of the "active" flag |
| 85 | * @param value true to set the flag, false to clear it. |
| 86 | */ |
| 87 | void setActive(bool value) { active = value ? 1 : 0; } |
| 88 | |
| 89 | /** |
| 90 | * Set the value of the "childInherit" flag |
| 91 | * @param value true to set the flag, false to clear it. |
| 92 | */ |
| 93 | void setChildInherit(bool value) { childInherit = value ? 1 : 0; } |
| 94 | |
| 95 | /** |
| 96 | * Set the value of the "advertise" flag |
| 97 | * @param value true to set the flag, false to clear it. |
| 98 | */ |
| 99 | void setAdvertise(bool value) { advertise = value ? 1 : 0; } |
| 100 | |
| 101 | /** |
| 102 | * Set the value of the "last" flag |
| 103 | * @param value true to set the flag, false to clear it. |
| 104 | */ |
| 105 | void setLast(bool value) { last = value ? 1 : 0; } |
| 106 | |
| 107 | /** |
| 108 | * Set the value of the "capture" flag |
| 109 | * @param value true to set the flag, false to clear it. |
| 110 | */ |
| 111 | void setCapture(bool value) { capture = value ? 1 : 0; } |
| 112 | |
| 113 | /** |
| 114 | * Set the value of the "local" flag |
| 115 | * @param value true to set the flag, false to clear it. |
| 116 | */ |
| 117 | void setLocal(bool value) { local = value ? 1 : 0; } |
| 118 | |
| 119 | /** |
| 120 | * Set the value of the "tap" flag |
| 121 | * @param value true to set the flag, false to clear it. |
| 122 | */ |
| 123 | void setTap(bool value) { tap = value ? 1 : 0; } |
| 124 | |
| 125 | /** |
| 126 | * Set the value of the "captureOk" flag |
| 127 | * @param value true to set the flag, false to clear it. |
| 128 | */ |
| 129 | void setCaptureOk(bool value) { captureOk = value ? 1 : 0; } |
| 130 | }; |
| 131 | |
| 132 | } |
| 133 | |
| 134 | #endif |