blob: d1cbb23666313b3470e333fa05247ea86d48ddce [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#ifndef NLSR_SM_HPP
2#define NLSR_SM_HPP
3
4#include<list>
5#include<string>
6#include <ndn-cpp-dev/face.hpp>
7
akmhoque1fd8c1e2014-02-19 19:41:49 -06008namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -06009{
akmhoque298385a2014-02-13 14:13:09 -060010
akmhoque5a44dd42014-03-12 18:11:32 -050011 using namespace std;
akmhoque298385a2014-02-13 14:13:09 -060012
akmhoque5a44dd42014-03-12 18:11:32 -050013 class SequencingManager
14 {
15 public:
16 SequencingManager()
17 : nameLsaSeq(0)
18 , adjLsaSeq(0)
19 , corLsaSeq(0)
20 , combinedSeqNo(0)
21 , seqFileNameWithPath()
akmhoque1fd8c1e2014-02-19 19:41:49 -060022 {
akmhoque5a44dd42014-03-12 18:11:32 -050023 }
akmhoque298385a2014-02-13 14:13:09 -060024
akmhoque5a44dd42014-03-12 18:11:32 -050025 SequencingManager(uint64_t seqNo)
26 {
27 splittSequenceNo(seqNo);
28 }
akmhoque2bb198e2014-02-28 11:46:27 -060029
akmhoque5a44dd42014-03-12 18:11:32 -050030 SequencingManager(uint64_t nlsn, uint64_t alsn, uint64_t clsn)
31 {
32 nameLsaSeq=nlsn;
33 adjLsaSeq=alsn;
34 corLsaSeq=clsn;
35 combineSequenceNo();
36 }
akmhoque298385a2014-02-13 14:13:09 -060037
akmhoque5a44dd42014-03-12 18:11:32 -050038 uint64_t getNameLsaSeq() const
39 {
40 return nameLsaSeq;
41 }
akmhoque298385a2014-02-13 14:13:09 -060042
akmhoque5a44dd42014-03-12 18:11:32 -050043 void setNameLsaSeq(uint64_t nlsn)
44 {
45 nameLsaSeq=nlsn;
46 combineSequenceNo();
47 }
akmhoque298385a2014-02-13 14:13:09 -060048
akmhoque5a44dd42014-03-12 18:11:32 -050049 uint64_t getAdjLsaSeq() const
50 {
51 return adjLsaSeq;
52 }
akmhoque298385a2014-02-13 14:13:09 -060053
akmhoque5a44dd42014-03-12 18:11:32 -050054 void setAdjLsaSeq(uint64_t alsn)
55 {
56 adjLsaSeq=alsn;
57 combineSequenceNo();
58 }
akmhoque1fd8c1e2014-02-19 19:41:49 -060059
akmhoque5a44dd42014-03-12 18:11:32 -050060 uint64_t getCorLsaSeq() const
61 {
62 return corLsaSeq;
63 }
akmhoque1fd8c1e2014-02-19 19:41:49 -060064
akmhoque5a44dd42014-03-12 18:11:32 -050065 void setCorLsaSeq(uint64_t clsn)
66 {
67 corLsaSeq=clsn;
68 combineSequenceNo();
69 }
akmhoque1fd8c1e2014-02-19 19:41:49 -060070
akmhoque5a44dd42014-03-12 18:11:32 -050071 uint64_t getCombinedSeqNo() const
72 {
73 return combinedSeqNo;
74 }
akmhoque2bb198e2014-02-28 11:46:27 -060075
akmhoque5a44dd42014-03-12 18:11:32 -050076 void writeSeqNoToFile();
77 void initiateSeqNoFromFile();
78 void setSeqFileName(string filePath);
79 string getUserHomeDirectory();
akmhoque2bb198e2014-02-28 11:46:27 -060080
akmhoque5a44dd42014-03-12 18:11:32 -050081 private:
82 void splittSequenceNo(uint64_t seqNo);
83 void combineSequenceNo();
akmhoque2bb198e2014-02-28 11:46:27 -060084
85
akmhoque5a44dd42014-03-12 18:11:32 -050086 private:
87 uint64_t nameLsaSeq;
88 uint64_t adjLsaSeq;
89 uint64_t corLsaSeq;
90 uint64_t combinedSeqNo;
91 string seqFileNameWithPath;
92 };
akmhoque298385a2014-02-13 14:13:09 -060093
akmhoqueb1710aa2014-02-19 17:13:36 -060094
akmhoque5a44dd42014-03-12 18:11:32 -050095 ostream& operator <<(ostream& os, const SequencingManager& sm);
akmhoqueb1710aa2014-02-19 17:13:36 -060096}//namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -060097#endif