akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 1 | #ifndef NLSR_SM_HPP |
2 | #define NLSR_SM_HPP | ||||
3 | |||||
4 | #include<list> | ||||
5 | #include<string> | ||||
6 | #include <ndn-cpp-dev/face.hpp> | ||||
7 | |||||
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 8 | namespace nlsr |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 9 | { |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 10 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 11 | using namespace std; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 12 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 13 | class SequencingManager |
14 | { | ||||
15 | public: | ||||
16 | SequencingManager() | ||||
17 | : nameLsaSeq(0) | ||||
18 | , adjLsaSeq(0) | ||||
19 | , corLsaSeq(0) | ||||
20 | , combinedSeqNo(0) | ||||
21 | , seqFileNameWithPath() | ||||
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 22 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 23 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 24 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 25 | SequencingManager(uint64_t seqNo) |
26 | { | ||||
27 | splittSequenceNo(seqNo); | ||||
28 | } | ||||
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 29 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 30 | SequencingManager(uint64_t nlsn, uint64_t alsn, uint64_t clsn) |
31 | { | ||||
32 | nameLsaSeq=nlsn; | ||||
33 | adjLsaSeq=alsn; | ||||
34 | corLsaSeq=clsn; | ||||
35 | combineSequenceNo(); | ||||
36 | } | ||||
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 37 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 38 | uint64_t getNameLsaSeq() const |
39 | { | ||||
40 | return nameLsaSeq; | ||||
41 | } | ||||
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 42 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 43 | void setNameLsaSeq(uint64_t nlsn) |
44 | { | ||||
45 | nameLsaSeq=nlsn; | ||||
46 | combineSequenceNo(); | ||||
47 | } | ||||
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 48 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 49 | uint64_t getAdjLsaSeq() const |
50 | { | ||||
51 | return adjLsaSeq; | ||||
52 | } | ||||
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 53 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 54 | void setAdjLsaSeq(uint64_t alsn) |
55 | { | ||||
56 | adjLsaSeq=alsn; | ||||
57 | combineSequenceNo(); | ||||
58 | } | ||||
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 59 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 60 | uint64_t getCorLsaSeq() const |
61 | { | ||||
62 | return corLsaSeq; | ||||
63 | } | ||||
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 64 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 65 | void setCorLsaSeq(uint64_t clsn) |
66 | { | ||||
67 | corLsaSeq=clsn; | ||||
68 | combineSequenceNo(); | ||||
69 | } | ||||
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 70 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 71 | uint64_t getCombinedSeqNo() const |
72 | { | ||||
73 | return combinedSeqNo; | ||||
74 | } | ||||
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 75 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 76 | void writeSeqNoToFile(); |
77 | void initiateSeqNoFromFile(); | ||||
78 | void setSeqFileName(string filePath); | ||||
79 | string getUserHomeDirectory(); | ||||
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 80 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 81 | private: |
82 | void splittSequenceNo(uint64_t seqNo); | ||||
83 | void combineSequenceNo(); | ||||
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 84 | |
85 | |||||
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 86 | private: |
87 | uint64_t nameLsaSeq; | ||||
88 | uint64_t adjLsaSeq; | ||||
89 | uint64_t corLsaSeq; | ||||
90 | uint64_t combinedSeqNo; | ||||
91 | string seqFileNameWithPath; | ||||
92 | }; | ||||
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 93 | |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame] | 94 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 95 | ostream& operator <<(ostream& os, const SequencingManager& sm); |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame] | 96 | }//namespace nlsr |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 97 | #endif |