blob: 703795a19a6480b86b4475cfabaa8ca8d86ae7f6 [file] [log] [blame]
Jeff Thompson47eecfc2013-07-07 22:56:46 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
Jeff Thompson9c41dfe2013-06-27 12:10:25 -07004 */
5
6#include <stdexcept>
Jeff Thompson53412192013-08-06 13:35:50 -07007#include "wire-format.hpp"
Jeff Thompson9c41dfe2013-06-27 12:10:25 -07008
9using namespace std;
10
11namespace ndn {
Jeff Thompsonfa181ac2013-08-02 19:00:51 -070012
Jeff Thompson1a1312d2013-08-05 19:08:35 -070013static bool gotInitialDefaultWireFormat = false;
Jeff Thompsonfa181ac2013-08-02 19:00:51 -070014
Jeff Thompson535f21a2013-08-05 18:25:46 -070015WireFormat *WireFormat::defaultWireFormat_ = 0;
16
17WireFormat *WireFormat::getDefaultWireFormat()
18{
Jeff Thompson1a1312d2013-08-05 19:08:35 -070019 if (!defaultWireFormat_ && !gotInitialDefaultWireFormat) {
Jeff Thompson535f21a2013-08-05 18:25:46 -070020 // There is no defaultWireFormat_ and we have not yet initialized initialDefaultWireFormat_, so initialize and use it.
Jeff Thompson1a1312d2013-08-05 19:08:35 -070021 gotInitialDefaultWireFormat = true;
22 // NOTE: This allocates one object which we never free for the life of the application.
23 defaultWireFormat_ = newInitialDefaultWireFormat();
Jeff Thompson535f21a2013-08-05 18:25:46 -070024 }
25
26 return defaultWireFormat_;
27}
Jeff Thompsonfa181ac2013-08-02 19:00:51 -070028
Jeff Thompsonb0979fd2013-07-30 15:48:21 -070029ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeInterest(const Interest &interest)
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070030{
31 throw logic_error("unimplemented");
32}
Jeff Thompson42380712013-06-28 10:59:33 -070033void WireFormat::decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength)
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070034{
35 throw logic_error("unimplemented");
36}
37
Jeff Thompsonc87f39a2013-08-12 11:55:11 -070038ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData
39 (const Data &data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070040{
41 throw logic_error("unimplemented");
42}
Jeff Thompsonc87f39a2013-08-12 11:55:11 -070043void WireFormat::decodeData
44 (Data &data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070045{
46 throw logic_error("unimplemented");
47}
48
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070049}