Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <stdexcept> |
| 7 | #include "WireFormat.hpp" |
| 8 | |
| 9 | using namespace std; |
| 10 | |
| 11 | namespace ndn { |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 12 | |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame^] | 13 | ptr_lib::shared_ptr<WireFormat> WireFormat::initialDefaultWireFormat_; |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 14 | |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame^] | 15 | WireFormat *WireFormat::defaultWireFormat_ = 0; |
| 16 | |
| 17 | WireFormat *WireFormat::getDefaultWireFormat() |
| 18 | { |
| 19 | if (!defaultWireFormat_ && !initialDefaultWireFormat_) { |
| 20 | // There is no defaultWireFormat_ and we have not yet initialized initialDefaultWireFormat_, so initialize and use it. |
| 21 | // NOTE: This could have been done with a static initializer on initialDefaultWireFormat_, but this does not have |
| 22 | // good cross-platform support, especially for dynamic shared libraries. |
| 23 | initialDefaultWireFormat_.reset(newInitialDefaultWireFormat()); |
| 24 | defaultWireFormat_ = initialDefaultWireFormat_.get(); |
| 25 | } |
| 26 | |
| 27 | return defaultWireFormat_; |
| 28 | } |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 29 | |
Jeff Thompson | b0979fd | 2013-07-30 15:48:21 -0700 | [diff] [blame] | 30 | ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeInterest(const Interest &interest) |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 31 | { |
| 32 | throw logic_error("unimplemented"); |
| 33 | } |
Jeff Thompson | 4238071 | 2013-06-28 10:59:33 -0700 | [diff] [blame] | 34 | void WireFormat::decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength) |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 35 | { |
| 36 | throw logic_error("unimplemented"); |
| 37 | } |
| 38 | |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 39 | ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData(const Data &data) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 40 | { |
| 41 | throw logic_error("unimplemented"); |
| 42 | } |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 43 | void WireFormat::decodeData(Data &data, const unsigned char *input, unsigned int inputLength) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 44 | { |
| 45 | throw logic_error("unimplemented"); |
| 46 | } |
| 47 | |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 48 | } |