management: replace FaceFlags with individual fields
refs #1992
Change-Id: I2b8e999fcf27444b8f3805f23da9f8ef9bcb5624
diff --git a/src/management/nfd-face-status.hpp b/src/management/nfd-face-status.hpp
index eff9c83..237b3f1 100644
--- a/src/management/nfd-face-status.hpp
+++ b/src/management/nfd-face-status.hpp
@@ -23,11 +23,8 @@
#define NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
// This include must be kept as the first one, to ensure nfd-face-flags.hpp compiles on its own.
-#include "nfd-face-flags.hpp"
+#include "nfd-face-traits.hpp"
-#include "../encoding/tlv-nfd.hpp"
-#include "../encoding/encoding-buffer.hpp"
-#include "../encoding/block-helpers.hpp"
#include "../util/time.hpp"
namespace ndn {
@@ -38,26 +35,13 @@
* \brief represents Face status
* \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
*/
-class FaceStatus : public FaceFlagsTraits<FaceStatus>
+class FaceStatus : public FaceTraits<FaceStatus>
{
public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
FaceStatus();
explicit
- FaceStatus(const Block& block)
- {
- this->wireDecode(block);
- }
+ FaceStatus(const Block& block);
/** \brief prepend FaceStatus to the encoder
*/
@@ -76,48 +60,6 @@
wireDecode(const Block& wire);
public: // getters & setters
- uint64_t
- getFaceId() const
- {
- return m_faceId;
- }
-
- FaceStatus&
- setFaceId(uint64_t faceId)
- {
- m_wire.reset();
- m_faceId = faceId;
- return *this;
- }
-
- const std::string&
- getRemoteUri() const
- {
- return m_remoteUri;
- }
-
- FaceStatus&
- setRemoteUri(const std::string& remoteUri)
- {
- m_wire.reset();
- m_remoteUri = remoteUri;
- return *this;
- }
-
- const std::string&
- getLocalUri() const
- {
- return m_localUri;
- }
-
- FaceStatus&
- setLocalUri(const std::string& localUri)
- {
- m_wire.reset();
- m_localUri = localUri;
- return *this;
- }
-
bool
hasExpirationPeriod() const
{
@@ -132,26 +74,7 @@
}
FaceStatus&
- setExpirationPeriod(const time::milliseconds& expirationPeriod)
- {
- m_expirationPeriod = expirationPeriod;
- m_hasExpirationPeriod = true;
- return *this;
- }
-
- uint64_t
- getFlags() const
- {
- return m_flags;
- }
-
- FaceStatus&
- setFlags(uint64_t flags)
- {
- m_wire.reset();
- m_flags = flags;
- return *this;
- }
+ setExpirationPeriod(const time::milliseconds& expirationPeriod);
uint64_t
getNInInterests() const
@@ -160,12 +83,7 @@
}
FaceStatus&
- setNInInterests(uint64_t nInInterests)
- {
- m_wire.reset();
- m_nInInterests = nInInterests;
- return *this;
- }
+ setNInInterests(uint64_t nInInterests);
uint64_t
getNInDatas() const
@@ -174,12 +92,7 @@
}
FaceStatus&
- setNInDatas(uint64_t nInDatas)
- {
- m_wire.reset();
- m_nInDatas = nInDatas;
- return *this;
- }
+ setNInDatas(uint64_t nInDatas);
uint64_t
getNOutInterests() const
@@ -188,12 +101,7 @@
}
FaceStatus&
- setNOutInterests(uint64_t nOutInterests)
- {
- m_wire.reset();
- m_nOutInterests = nOutInterests;
- return *this;
- }
+ setNOutInterests(uint64_t nOutInterests);
uint64_t
getNOutDatas() const
@@ -202,12 +110,7 @@
}
FaceStatus&
- setNOutDatas(uint64_t nOutDatas)
- {
- m_wire.reset();
- m_nOutDatas = nOutDatas;
- return *this;
- }
+ setNOutDatas(uint64_t nOutDatas);
uint64_t
getNInBytes() const
@@ -216,12 +119,7 @@
}
FaceStatus&
- setNInBytes(uint64_t nInBytes)
- {
- m_wire.reset();
- m_nInBytes = nInBytes;
- return *this;
- }
+ setNInBytes(uint64_t nInBytes);
uint64_t
getNOutBytes() const
@@ -230,20 +128,15 @@
}
FaceStatus&
- setNOutBytes(uint64_t nOutBytes)
- {
- m_wire.reset();
- m_nOutBytes = nOutBytes;
- return *this;
- }
+ setNOutBytes(uint64_t nOutBytes);
+
+protected:
+ void
+ wireReset() const;
private:
- uint64_t m_faceId;
- std::string m_remoteUri;
- std::string m_localUri;
time::milliseconds m_expirationPeriod;
bool m_hasExpirationPeriod;
- uint64_t m_flags;
uint64_t m_nInInterests;
uint64_t m_nInDatas;
uint64_t m_nOutInterests;