-public:
- typedef RESETABLE<uint64_t> ValueType;
- typedef std::vector<ValueType> ContainerType;
- typedef ContainerType::size_type IndexType;
-
- DIR_TRAFF_RES() : traff(DIR_NUM) {}
- DIR_TRAFF_RES(const DIR_TRAFF & ts)
- : traff(ts.size())
- {
- for (IndexType i = 0; i < ts.size(); ++i)
- traff[i] = ts[i];
- }
- const ValueType & operator[](IndexType idx) const { return traff[idx]; }
- ValueType & operator[](IndexType idx) { return traff[idx]; }
- DIR_TRAFF GetData() const
- {
- DIR_TRAFF res;
- for (IndexType i = 0; i < traff.size(); ++i)
- if (!traff[i].empty())
- res[i] = traff[i].data();
- return res;
- }
-
-private:
- ContainerType traff;
+ public:
+ using ValueType = std::optional<uint64_t>;
+ using ContainerType = std::vector<ValueType>;
+ using IndexType = ContainerType::size_type;
+
+ DirTraffOpt() noexcept: traff(DIR_NUM) {}
+ explicit DirTraffOpt(const DirTraff & ts) noexcept
+ : traff(ts.size())
+ {
+ for (IndexType i = 0; i < ts.size(); ++i)
+ traff[i] = ts[i];
+ }
+ DirTraffOpt& operator=(const DirTraff& ts) noexcept
+ {
+ for (IndexType i = 0; i < ts.size(); ++i)
+ traff[i] = ts[i];
+ return *this;
+ }
+ const ValueType & operator[](IndexType idx) const noexcept { return traff[idx]; }
+ ValueType & operator[](IndexType idx) noexcept { return traff[idx]; }
+ IndexType size() const noexcept { return traff.size(); }
+
+ private:
+ ContainerType traff;