Zhenkai Zhu | 9bad2bf | 2012-12-28 15:31:46 -0800 | [diff] [blame] | 1 | #ifndef CCNX_INTEREST_H |
| 2 | #define CCNX_INTEREST_H |
| 3 | #include "ccnx-common.h" |
| 4 | |
| 5 | namespace Ccnx { |
| 6 | |
| 7 | // Currently, other classes use string when Interest is needed. |
| 8 | // The constructor from string ensures that if we change other classes' APIs to use Interest object |
| 9 | // instead of string, it is still backwards compatible |
| 10 | // Using a separate Interest class instead of simple string allows us to add control fields |
| 11 | // to the Interest, e.g. ChildSelector. Perhaps that's a separate Selectors class. Will do it after ChronoShare project finishes. |
| 12 | |
| 13 | // Since the selector is only useful when sending Interest (in callbacks, usually we only need to know the name of the Interest), |
| 14 | // we currently only use Interest object in sendInterest of CcnxWrapper. In other places, Interest object is equivalent of |
| 15 | // its string name. |
| 16 | |
| 17 | class Interest |
| 18 | { |
| 19 | public: |
| 20 | Interest(const string &name) : m_name(name) {} |
| 21 | virtual ~Interest() {} |
| 22 | |
| 23 | string |
| 24 | name() const { return m_name; } |
| 25 | |
| 26 | protected: |
| 27 | string m_name; |
| 28 | }; |
| 29 | |
| 30 | } // Ccnx |
| 31 | #endif |