mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-01 11:17:52 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -8,10 +8,9 @@
|
||||
|
||||
namespace OpenWifi {
|
||||
class SerialNumberCache : public SubSystemServer {
|
||||
public:
|
||||
|
||||
public:
|
||||
static auto instance() {
|
||||
static auto instance_ = new SerialNumberCache;
|
||||
static auto instance_ = new SerialNumberCache;
|
||||
return instance_;
|
||||
}
|
||||
|
||||
@@ -21,29 +20,29 @@ namespace OpenWifi {
|
||||
void DeleteSerialNumber(const std::string &SerialNumber);
|
||||
void FindNumbers(const std::string &SerialNumber, uint HowMany, std::vector<uint64_t> &A);
|
||||
inline bool NumberExists(uint64_t SerialNumber) {
|
||||
std::lock_guard G(Mutex_);
|
||||
return std::find(SNs_.begin(),SNs_.end(),SerialNumber)!=SNs_.end();
|
||||
std::lock_guard G(Mutex_);
|
||||
return std::find(SNs_.begin(), SNs_.end(), SerialNumber) != SNs_.end();
|
||||
}
|
||||
|
||||
static inline std::string ReverseSerialNumber(const std::string &S) {
|
||||
std::string ReversedString;
|
||||
std::copy(rbegin(S),rend(S),std::back_inserter(ReversedString));
|
||||
std::copy(rbegin(S), rend(S), std::back_inserter(ReversedString));
|
||||
return ReversedString;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uint64_t> SNs_;
|
||||
std::vector<uint64_t> Reverse_SNs_;
|
||||
std::vector<uint64_t> SNs_;
|
||||
std::vector<uint64_t> Reverse_SNs_;
|
||||
|
||||
void ReturnNumbers(const std::string &S, uint HowMany, const std::vector<uint64_t> & SNArr, std::vector<uint64_t> &A, bool ReverseResult);
|
||||
void ReturnNumbers(const std::string &S, uint HowMany, const std::vector<uint64_t> &SNArr,
|
||||
std::vector<uint64_t> &A, bool ReverseResult);
|
||||
|
||||
SerialNumberCache() noexcept:
|
||||
SubSystemServer("SerialNumberCache", "SNCACHE-SVR", "serialcache")
|
||||
{
|
||||
SNs_.reserve(2000);
|
||||
}
|
||||
SerialNumberCache() noexcept
|
||||
: SubSystemServer("SerialNumberCache", "SNCACHE-SVR", "serialcache") {
|
||||
SNs_.reserve(2000);
|
||||
}
|
||||
};
|
||||
|
||||
inline auto SerialNumberCache() { return SerialNumberCache::instance(); }
|
||||
|
||||
} // namespace OpenWiFi
|
||||
} // namespace OpenWifi
|
||||
|
||||
Reference in New Issue
Block a user