blob: 0c52c7abc0fd72ad56f1cbd0369de1ae484ccee5 [file] [log] [blame]
Zhenkai Zhu43eb2732012-12-28 00:48:26 -08001#ifndef CCNX_CONTENT_OBJECT_H
2#define CCNX_CONTENT_OBJECT_H
3
Zhenkai Zhu43eb2732012-12-28 00:48:26 -08004#include "ccnx-wrapper.h"
Zhenkai Zhu974c5a62012-12-28 14:15:30 -08005#include "ccnx-common.h"
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -08006#include "ccnx-name.h"
Zhenkai Zhu43eb2732012-12-28 00:48:26 -08007
8using namespace std;
9
10namespace Ccnx {
11
12struct MisformedContentObjectException : virtual boost::exception, virtual exception { };
13
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080014class ParsedContentObject
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080015{
16public:
17 ParsedContentObject(const unsigned char *data, size_t len);
18 ParsedContentObject(const Bytes &bytes);
19 ParsedContentObject(const ParsedContentObject &other);
20 virtual ~ParsedContentObject();
21
22 Bytes
Zhenkai Zhubad089c2012-12-28 10:28:27 -080023 content() const;
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080024
Alexander Afanasyevdbc06712013-01-08 18:30:28 -080025 BytesPtr
26 contentPtr() const;
27
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -080028 Name
Zhenkai Zhubad089c2012-12-28 10:28:27 -080029 name() const;
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080030
Zhenkai Zhu9f2ef6f2013-01-04 21:46:08 -080031private:
32 void
33 init(const unsigned char *data, size_t len);
34
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080035protected:
Zhenkai Zhu90611802013-01-04 21:30:24 -080036 ccn_parsed_ContentObject m_pco;
37 ccn_indexbuf *m_comps;
38 Bytes m_bytes;
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080039};
40
41typedef boost::shared_ptr<ParsedContentObject> PcoPtr;
42
43}
44
45#endif // CCNX_CONTENT_OBJECT_H