Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 1 | .. _Interest: |
| 2 | |
| 3 | Interest Class |
| 4 | ============== |
| 5 | |
| 6 | :[C++]: |
| 7 | Namespace: ``ndn`` |
| 8 | |
| 9 | :[Python]: |
| 10 | Module: ``pyndn`` |
| 11 | |
| 12 | Interest Constructor |
| 13 | -------------------- |
| 14 | |
| 15 | Create a new Interest with the optional values. |
| 16 | |
| 17 | :[C++]: |
| 18 | |
| 19 | .. code-block:: c++ |
| 20 | |
| 21 | Interest( |
| 22 | |
| 23 | [const Name& name] |
| 24 | [, int minSuffixComponents] |
| 25 | [, int maxSuffixComponents] |
| 26 | [, const PublisherPublicKeyDigest& publisherPublicKeyDigest] |
| 27 | [, const Exclude& exclude] |
| 28 | [, int childSelector] |
| 29 | [, int answerOriginKind] |
| 30 | [, int scope] |
| 31 | [, Milliseconds interestLifetimeMilliseconds] |
| 32 | [, const std::vector<uint8_t>& nonce] |
| 33 | |
| 34 | ); |
| 35 | |
| 36 | :[JavaScript]: |
| 37 | |
| 38 | .. code-block:: javascript |
| 39 | |
| 40 | var Interest = function Interest ( |
| 41 | |
| 42 | [name // Name] |
| 43 | [, minSuffixComponents // number] |
| 44 | [, maxSuffixComponents // number] |
| 45 | [, publisherPublicKeyDigest // PublisherPublicKeyDigest] |
| 46 | [, exclude // Exclude] |
| 47 | [, childSelector // number] |
| 48 | [, answerOriginKind // number] |
| 49 | [, scope // number] |
| 50 | [, interestLifetimeMilliseconds // number] |
| 51 | [, nonce // Uint8Array] |
| 52 | |
| 53 | ) |
| 54 | |
| 55 | :[Python]: |
| 56 | |
| 57 | .. code-block:: python |
| 58 | |
| 59 | def __init__(self |
| 60 | |
| 61 | [, name // Name] |
| 62 | [, minSuffixComponents // int] |
| 63 | [, maxSuffixComponents // int] |
| 64 | [, publisherPublicKeyDigest // string] |
| 65 | [, exclude // Exclude] |
| 66 | [, childSelector // int] |
| 67 | [, answerOriginKind // int] |
| 68 | [, scope // int] |
| 69 | [, interestLifetime // float] |
| 70 | [, nonce // string] |
| 71 | |
| 72 | ) |
| 73 | |
| 74 | :Parameters: |
| 75 | |
| 76 | - ``name`` |
| 77 | (optional) The name of the content. |
| 78 | |
| 79 | .. TODO: define other parameters |
| 80 | |
| 81 | Interest.wireDecode Method |
| 82 | -------------------------- |
| 83 | |
Alexander Afanasyev | 2470786 | 2013-11-26 19:31:45 -0800 | [diff] [blame] | 84 | Decode the input from wire format and update this Interest. |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 85 | |
| 86 | :[C++]: |
| 87 | |
| 88 | .. code-block:: c++ |
| 89 | |
| 90 | void decode( |
| 91 | |
| 92 | const std::vector<uint8_t>& input |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 93 | |
| 94 | ); |
| 95 | |
| 96 | :[JavaScript]: |
| 97 | |
| 98 | .. code-block:: javascript |
| 99 | |
| 100 | Interest.prototype.decode = function( |
| 101 | |
| 102 | input // Uint8Array |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 103 | |
| 104 | ) |
| 105 | |
| 106 | :Parameters: |
| 107 | |
| 108 | - ``input`` |
| 109 | The input byte array to be decoded. |
| 110 | |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 111 | |
| 112 | Interest.wireEncode Method |
| 113 | -------------------------- |
| 114 | |
Alexander Afanasyev | 2470786 | 2013-11-26 19:31:45 -0800 | [diff] [blame] | 115 | Encode this Interest to a wire format. |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 116 | |
| 117 | :[C++]: |
| 118 | |
| 119 | .. code-block:: c++ |
| 120 | |
Alexander Afanasyev | 2470786 | 2013-11-26 19:31:45 -0800 | [diff] [blame] | 121 | Blob encode() const; |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 122 | |
| 123 | :[JavaScript]: |
| 124 | |
| 125 | .. code-block:: javascript |
| 126 | |
| 127 | // Returns Uint8Array |
Alexander Afanasyev | 2470786 | 2013-11-26 19:31:45 -0800 | [diff] [blame] | 128 | Interest.prototype.encode = function() |
Alexander Afanasyev | 2d600f7 | 2013-11-21 18:20:37 -0800 | [diff] [blame] | 129 | |
| 130 | :Returns: |
| 131 | |
| 132 | The encoded byte array. |
| 133 | |
| 134 | Interest.matchesName Method |
| 135 | --------------------------- |
| 136 | |
| 137 | Return true if the components of this Interest’s name are the same as the leading components of the given name, and the name conforms to the interest selectors. |
| 138 | |
| 139 | :[C++]: |
| 140 | |
| 141 | .. code-block:: c++ |
| 142 | |
| 143 | bool matchesName( |
| 144 | |
| 145 | const Name& name |
| 146 | |
| 147 | ) const; |
| 148 | |
| 149 | :[JavaScript]: |
| 150 | |
| 151 | .. code-block:: javascript |
| 152 | |
| 153 | // Returns boolean |
| 154 | Interest.prototype.matchesName = function( |
| 155 | |
| 156 | name // Name |
| 157 | |
| 158 | ) |
| 159 | |
| 160 | :[Python]: |
| 161 | |
| 162 | .. code-block:: python |
| 163 | |
| 164 | # Returns True or False |
| 165 | def matches_name(self, |
| 166 | |
| 167 | name # Name |
| 168 | |
| 169 | ) |
| 170 | |
| 171 | :Parameters: |
| 172 | |
| 173 | - ``name`` |
| 174 | The Name to check against this Interest. |
| 175 | |
| 176 | :Returns: |
| 177 | |
| 178 | True if this interest’s name and interest selectors match the name. |
| 179 | |