00001 #ifndef DICTIONARY_H_
00002 #define DICTIONARY_H_
00003
00004 #include <string>
00005 #include "Exceptions.h"
00006 #include <map>
00007
00008 using namespace std;
00009
00010 namespace dtn
00011 {
00012 namespace data
00013 {
00017 class Dictionary
00018 {
00019 public:
00023 Dictionary();
00024
00028 virtual ~Dictionary();
00029
00033 pair<unsigned int, unsigned int> add(string uri);
00034
00038 string get(unsigned int scheme, unsigned int ssp) const;
00039
00043 string get(unsigned int pos) const;
00044
00048 unsigned int get(string entry) const;
00049
00053 void read(unsigned char *data, unsigned int length);
00054
00058 unsigned int getLength() const;
00059
00063 unsigned int getSize() const;
00064
00070 unsigned int write(unsigned char *data) const;
00071
00077 static pair<string, string> split(string uri) throw (exceptions::InvalidDataException);
00078
00079 private:
00083 bool exists(string entry);
00084
00088 struct m_positionSort {
00089 bool operator()( unsigned int pos1, unsigned int pos2 ) const {
00090 return (pos1 < pos2);
00091 }
00092 };
00093
00094 map<unsigned int, string, m_positionSort> m_entrys;
00095 };
00096 }
00097 }
00098
00099 #endif