summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-01-06 11:00:03 +0100
committerSven Gothel <[email protected]>2021-01-06 11:00:03 +0100
commitea6e9928c27ea59cb1368819b635c6f38a518557 (patch)
treea1d6c6a0e7703fcac809863901cd666697d21985 /src
parentc0c55bdeb99bb6b840cd5859f45050d61e736f45 (diff)
Replace jau::cow_vector with jau::cow_darray (simple type replacement, compatible API)
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/DBTAdapter.cpp4
-rw-r--r--src/direct_bt/DBTManager.cpp16
-rw-r--r--src/direct_bt/GATTHandler.cpp6
3 files changed, 13 insertions, 13 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index c35d3164..937c430c 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -524,7 +524,7 @@ bool DBTAdapter::removeDeviceFromWhitelist(const BDAddressAndType & addressAndTy
return mgmt.removeDeviceFromWhitelist(dev_id, addressAndType);
}
-static jau::cow_vector<std::shared_ptr<AdapterStatusListener>>::equal_comparator _adapterStatusListenerRefEqComparator =
+static jau::cow_darray<std::shared_ptr<AdapterStatusListener>>::equal_comparator _adapterStatusListenerRefEqComparator =
[](const std::shared_ptr<AdapterStatusListener> &a, const std::shared_ptr<AdapterStatusListener> &b) -> bool { return *a == *b; };
bool DBTAdapter::addStatusListener(std::shared_ptr<AdapterStatusListener> l) {
@@ -551,7 +551,7 @@ bool DBTAdapter::removeStatusListener(const AdapterStatusListener * l) {
throw jau::IllegalArgumentException("DBTAdapterStatusListener ref is null", E_FILE_LINE);
}
const std::lock_guard<std::recursive_mutex> lock(statusListenerList.get_write_mutex());
- std::shared_ptr<std::vector<std::shared_ptr<AdapterStatusListener>>> store = statusListenerList.copy_store();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterStatusListener>>> store = statusListenerList.copy_store();
int count = 0;
for(auto it = store->begin(); it != store->end(); ) {
if ( **it == *l ) {
diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp
index cce55d4d..aa996c33 100644
--- a/src/direct_bt/DBTManager.cpp
+++ b/src/direct_bt/DBTManager.cpp
@@ -480,7 +480,7 @@ next1:
{
// Not required: CTOR: const std::lock_guard<std::recursive_mutex> lock(adapterInfos.get_write_mutex());
// Not required: CTOR: std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> store = adapterInfos.copy_store();
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
for(int i=0; i < num_adapter; i++) {
const uint16_t dev_id = jau::get_uint16(data, 2+i*2, true /* littleEndian */);
@@ -611,7 +611,7 @@ void DBTManager::close() noexcept {
}
int DBTManager::findAdapterInfoIndex(const uint16_t dev_id) const noexcept {
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
auto begin = snapshot->begin();
auto it = std::find_if(begin, snapshot->end(), [&](std::shared_ptr<AdapterInfo> const& p) -> bool {
return p->dev_id == dev_id;
@@ -623,7 +623,7 @@ int DBTManager::findAdapterInfoIndex(const uint16_t dev_id) const noexcept {
}
}
int DBTManager::findAdapterInfoDevId(const EUI48 &mac) const noexcept {
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
auto begin = snapshot->begin();
auto it = std::find_if(begin, snapshot->end(), [&](std::shared_ptr<AdapterInfo> const& p) -> bool {
return p->address == mac;
@@ -635,7 +635,7 @@ int DBTManager::findAdapterInfoDevId(const EUI48 &mac) const noexcept {
}
}
std::shared_ptr<AdapterInfo> DBTManager::findAdapterInfo(const EUI48 &mac) const noexcept {
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
auto begin = snapshot->begin();
auto it = std::find_if(begin, snapshot->end(), [&](std::shared_ptr<AdapterInfo> const& p) -> bool {
return p->address == mac;
@@ -647,7 +647,7 @@ std::shared_ptr<AdapterInfo> DBTManager::findAdapterInfo(const EUI48 &mac) const
}
}
std::shared_ptr<AdapterInfo> DBTManager::getAdapterInfo(const uint16_t dev_id) const noexcept {
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
auto begin = snapshot->begin();
auto it = std::find_if(begin, snapshot->end(), [&](std::shared_ptr<AdapterInfo> const& p) -> bool {
return p->dev_id == dev_id;
@@ -660,7 +660,7 @@ std::shared_ptr<AdapterInfo> DBTManager::getAdapterInfo(const uint16_t dev_id) c
}
bool DBTManager::addAdapterInfo(std::shared_ptr<AdapterInfo> ai) noexcept {
const std::lock_guard<std::recursive_mutex> lock(adapterInfos.get_write_mutex());
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> store = adapterInfos.copy_store();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> store = adapterInfos.copy_store();
auto begin = store->begin();
auto it = std::find_if(begin, store->end(), [&](std::shared_ptr<AdapterInfo> const& p) -> bool {
@@ -677,7 +677,7 @@ bool DBTManager::addAdapterInfo(std::shared_ptr<AdapterInfo> ai) noexcept {
}
std::shared_ptr<AdapterInfo> DBTManager::removeAdapterInfo(const uint16_t dev_id) noexcept {
const std::lock_guard<std::recursive_mutex> lock(adapterInfos.get_write_mutex());
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> store = adapterInfos.copy_store();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> store = adapterInfos.copy_store();
for(auto it = store->begin(); it != store->end(); ) {
std::shared_ptr<AdapterInfo> & ai = *it;
@@ -704,7 +704,7 @@ BTMode DBTManager::getCurrentBTMode(uint16_t dev_id) const noexcept {
}
std::shared_ptr<AdapterInfo> DBTManager::getDefaultAdapterInfo() const noexcept {
- std::shared_ptr<std::vector<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
+ std::shared_ptr<jau::darray<std::shared_ptr<AdapterInfo>>> snapshot = adapterInfos.get_snapshot();
auto begin = snapshot->begin();
auto it = std::find_if(begin, snapshot->end(), [](std::shared_ptr<AdapterInfo> const& p) -> bool {
return p->isCurrentSettingBitSet(AdapterSetting::POWERED);
diff --git a/src/direct_bt/GATTHandler.cpp b/src/direct_bt/GATTHandler.cpp
index 8d3f43c2..253ff2e1 100644
--- a/src/direct_bt/GATTHandler.cpp
+++ b/src/direct_bt/GATTHandler.cpp
@@ -99,7 +99,7 @@ bool GATTHandler::validateConnected() noexcept {
return true;
}
-static jau::cow_vector<std::shared_ptr<GATTCharacteristicListener>>::equal_comparator _characteristicListenerRefEqComparator =
+static jau::cow_darray<std::shared_ptr<GATTCharacteristicListener>>::equal_comparator _characteristicListenerRefEqComparator =
[](const std::shared_ptr<GATTCharacteristicListener> &a, const std::shared_ptr<GATTCharacteristicListener> &b) -> bool { return *a == *b; };
bool GATTHandler::addCharacteristicListener(std::shared_ptr<GATTCharacteristicListener> l) {
@@ -124,7 +124,7 @@ bool GATTHandler::removeCharacteristicListener(const GATTCharacteristicListener
return false;
}
const std::lock_guard<std::recursive_mutex> lock(characteristicListenerList.get_write_mutex());
- std::shared_ptr<std::vector<std::shared_ptr<GATTCharacteristicListener>>> store = characteristicListenerList.copy_store();
+ std::shared_ptr<jau::darray<std::shared_ptr<GATTCharacteristicListener>>> store = characteristicListenerList.copy_store();
int count = 0;
for(auto it = store->begin(); it != store->end(); ) {
if ( **it == *l ) {
@@ -156,7 +156,7 @@ int GATTHandler::removeAllAssociatedCharacteristicListener(const GATTCharacteris
return false;
}
const std::lock_guard<std::recursive_mutex> lock(characteristicListenerList.get_write_mutex());
- std::shared_ptr<std::vector<std::shared_ptr<GATTCharacteristicListener>>> store = characteristicListenerList.copy_store();
+ std::shared_ptr<jau::darray<std::shared_ptr<GATTCharacteristicListener>>> store = characteristicListenerList.copy_store();
int count = 0;
for(auto it = store->begin(); it != store->end(); ) {
if ( (*it)->match(*associatedCharacteristic) ) {