IBR-DTNSuite  0.8
ibrdtn/ibrdtn/data/Dictionary.h
Go to the documentation of this file.
00001 /*
00002  * Dictionary.h
00003  *
00004  *  Created on: 29.05.2009
00005  *      Author: morgenro
00006  */
00007 
00008 
00009 
00010 #ifndef DICTIONARY_H_
00011 #define DICTIONARY_H_
00012 
00013 #include "ibrdtn/data/EID.h"
00014 #include <list>
00015 #include <sstream>
00016 #include <list>
00017 
00018 using namespace std;
00019 
00020 namespace dtn
00021 {
00022         namespace data
00023         {
00024                 class Bundle;
00025 
00026                 class Dictionary
00027                 {
00028                 public:
00032                         Dictionary();
00033 
00037                         Dictionary(const dtn::data::Bundle &bundle);
00038 
00042                         Dictionary(const Dictionary &d);
00043 
00047                         Dictionary& operator=(const Dictionary &d);
00048 
00052                         virtual ~Dictionary();
00053 
00057                         void add(const EID &eid);
00058 
00062                         void add(const list<EID> &eids);
00063 
00067                         EID get(size_t scheme, size_t ssp);
00068 
00072                         void clear();
00073 
00077                         size_t getSize() const;
00078 
00082                         pair<size_t, size_t> getRef(const EID &eid) const;
00083 
00084                         friend std::ostream &operator<<(std::ostream &stream, const dtn::data::Dictionary &obj);
00085                         friend std::istream &operator>>(std::istream &stream, dtn::data::Dictionary &obj);
00086 
00087                 private:
00088                         bool exists(const std::string) const;
00089                         void add(const std::string);
00090                         size_t get(const std::string) const;
00091 
00092                         stringstream _bytestream;
00093                 };
00094         }
00095 }
00096 
00097 #endif /* DICTIONARY_H_ */