Skip to content

Commit 922329d

Browse files
committed
mgmt: use std::bitset in ControlParametersCommandFormat
Change-Id: I3054fbcc1cb9e5315ca426db59736d486464211d
1 parent aebf5d7 commit 922329d

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

ndn-cxx/mgmt/nfd/control-command.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323

2424
namespace ndn::nfd {
2525

26-
ControlParametersCommandFormat::ControlParametersCommandFormat()
27-
: m_required(CONTROL_PARAMETER_UBOUND)
28-
, m_optional(CONTROL_PARAMETER_UBOUND)
29-
{
30-
}
31-
3226
void
3327
ControlParametersCommandFormat::validate(const ControlParameters& parameters) const
3428
{

ndn-cxx/mgmt/nfd/control-command.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "ndn-cxx/interest.hpp"
2626
#include "ndn-cxx/mgmt/nfd/control-parameters.hpp"
2727

28+
#include <bitset>
29+
2830
namespace ndn::nfd {
2931

3032
/**
@@ -47,15 +49,13 @@ class ControlParametersCommandFormat
4749
public:
4850
using ParametersType = ControlParameters;
4951

50-
ControlParametersCommandFormat();
51-
5252
/**
5353
* \brief Declare a required field.
5454
*/
5555
ControlParametersCommandFormat&
5656
required(ControlParameterField field)
5757
{
58-
m_required[field] = true;
58+
m_required.set(field);
5959
return *this;
6060
}
6161

@@ -65,7 +65,7 @@ class ControlParametersCommandFormat
6565
ControlParametersCommandFormat&
6666
optional(ControlParameterField field)
6767
{
68-
m_optional[field] = true;
68+
m_optional.set(field);
6969
return *this;
7070
}
7171

@@ -85,8 +85,8 @@ class ControlParametersCommandFormat
8585
encode(Interest& interest, const ControlParameters& params) const;
8686

8787
private:
88-
std::vector<bool> m_required;
89-
std::vector<bool> m_optional;
88+
std::bitset<CONTROL_PARAMETER_UBOUND> m_required;
89+
std::bitset<CONTROL_PARAMETER_UBOUND> m_optional;
9090
};
9191

9292

0 commit comments

Comments
 (0)