blob: 60e3f193cc9d1f78ea32701db760c7c1c4d26fec [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 Thompson56ec9e22013-08-02 11:34:07 -070038ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData(const Data &data)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070039{
40 throw logic_error("unimplemented");
41}
Jeff Thompson56ec9e22013-08-02 11:34:07 -070042void WireFormat::decodeData(Data &data, const unsigned char *input, unsigned int inputLength)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070043{
44 throw logic_error("unimplemented");
45}
46
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070047}