PIMap some doc
This commit is contained in:
@@ -613,7 +613,8 @@ public:
|
||||
|
||||
//! \~english Returns a reverse iterator to the element.
|
||||
//! following the last element of the reversed array.
|
||||
//! \~russian Обратный итератор на элемент, следующий за последним элементом.
|
||||
//! \~russian Обратный итератор на элемент,
|
||||
//! следующий за последним элементом.
|
||||
//! \~\details 
|
||||
//!
|
||||
//! \~english It corresponds to the element preceding the first element of the non-reversed array.
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
//! \~english Copy constructor.
|
||||
//! \~russian Копирующий конструктор.
|
||||
inline PIMap(const PIMap<Key, T> & other) {*this = other;}
|
||||
inline PIMap(const PIMap<Key, T> & other) : pim_content(other.pim_content), pim_index(other.pim_index) {}
|
||||
|
||||
//! \~english Move constructor.
|
||||
//! \~russian Перемещающий конструктор.
|
||||
@@ -212,30 +212,30 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//! \~english Iterator to the first element.
|
||||
//! \~russian Итератор на первый элемент.
|
||||
inline iterator begin() {return iterator(this, 0);}
|
||||
|
||||
//! \~english Iterator to the element following the last element.
|
||||
//! \~russian Итератор на элемент, следующий за последним элементом.
|
||||
inline iterator end() {return iterator(this, size());}
|
||||
|
||||
inline const_iterator begin() const {return const_iterator(this, 0);}
|
||||
|
||||
inline const_iterator end() const {return const_iterator(this, size());}
|
||||
|
||||
inline const_iterator constBegin() const {return const_iterator(this, 0);}
|
||||
|
||||
inline const_iterator constEnd() const {return const_iterator(this, size());}
|
||||
|
||||
//! \~english Returns a reverse iterator to the first element of the reversed array.
|
||||
//! \~russian Обратный итератор на первый элемент.
|
||||
inline reverse_iterator rbegin() {return reverse_iterator(this, size() - 1);}
|
||||
|
||||
inline reverse_iterator rend() {return reverse_iterator(this, -1);}
|
||||
//! \~english Returns a reverse iterator to the element.
|
||||
//! following the last element of the reversed array.
|
||||
//! \~russian Обратный итератор на элемент,
|
||||
//! следующий за последним элементом.
|
||||
inline reverse_iterator rend() {return reverse_iterator(this, -1);}
|
||||
|
||||
inline const_reverse_iterator rbegin() const {return const_reverse_iterator(this, size() - 1);}
|
||||
|
||||
inline const_reverse_iterator rend() const {return const_reverse_iterator(this, -1);}
|
||||
|
||||
inline const_reverse_iterator constRbegin() const {return const_reverse_iterator(this, size() - 1);}
|
||||
|
||||
inline const_reverse_iterator constRend() const {return const_reverse_iterator(this, -1);}
|
||||
|
||||
//! \relatesalso PIMapIteratorConst
|
||||
inline PIMapIteratorConst<Key, T> makeIterator() const {return PIMapIteratorConst<Key, T>(*this);}
|
||||
|
||||
@@ -248,16 +248,48 @@ public:
|
||||
//! \relatesalso PIMapIteratorReverse
|
||||
inline PIMapIteratorReverse<Key, T> makeReverseIterator() {return PIMapIteratorReverse<Key, T>(*this);}
|
||||
|
||||
//! \~english Number of elements in the container.
|
||||
//! \~russian Количество элементов массива.
|
||||
//! \~\sa \a size_s(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
|
||||
inline size_t size() const {return pim_content.size();}
|
||||
|
||||
//! \~english Number of elements in the container as signed value.
|
||||
//! \~russian Количество элементов массива в виде знакового числа.
|
||||
//! \~\sa \a size(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
|
||||
inline int size_s() const {return pim_content.size_s();}
|
||||
|
||||
//! \~english Same as \a size().
|
||||
//! \~russian Синоним \a size().
|
||||
//! \~\sa \a size(), \a size_s(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
|
||||
inline size_t length() const {return pim_content.size();}
|
||||
|
||||
//! \~english Checks if the container has no elements.
|
||||
//! \~russian Проверяет пуст ли массив.
|
||||
//! \~\return
|
||||
//! \~english **true** if the container is empty, **false** otherwise
|
||||
//! \~russian **true** если массив пуст, **false** иначе.
|
||||
//! \~\sa \a size(), \a size_s(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
|
||||
inline bool isEmpty() const {return (pim_content.size() == 0);}
|
||||
|
||||
//! \~english Checks if the container has elements.
|
||||
//! \~russian Проверяет не пуст ли массив.
|
||||
//! \~\return
|
||||
//! \~english **true** if the container is not empty, **false** otherwise
|
||||
//! \~russian **true** если массив не пуст, **false** иначе.
|
||||
//! \~\sa \a size(), \a size_s(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
|
||||
inline bool isNotEmpty() const {return (pim_content.size() > 0);}
|
||||
|
||||
|
||||
//! \~english Full access to element key `key`.
|
||||
//! \~russian Полный доступ к элементу по ключу `key`.
|
||||
//! \~\details
|
||||
//! \~english If the map contains no item with key `key`,
|
||||
//! the function inserts a default-constructed value into the map with key `key`,
|
||||
//! and returns a reference to it.
|
||||
//! \~russian Если элемента с таким ключом `key` не существует,
|
||||
//! то он будет создан конструктором по умолчанию и добавлен в массив
|
||||
//! по ключу `key`, а затем возвращена ссылка на этот новый элемент.
|
||||
//! \~\sa \a insert(), \a value(), \a key()
|
||||
inline T & operator [](const Key & key) {
|
||||
bool f(false);
|
||||
ssize_t i = _find(key, f);
|
||||
@@ -267,6 +299,9 @@ public:
|
||||
return pim_content.back();
|
||||
}
|
||||
|
||||
//! \~english Same as \a value().
|
||||
//! \~russian Синоним \a value().
|
||||
//! \~\sa \a operator[](), \a value(), \a key()
|
||||
inline T at(const Key & key) const {return value(key);}
|
||||
|
||||
inline T take(const Key & key) const {
|
||||
@@ -278,6 +313,8 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//! \~english Inserts all elements in array `other` to this array with overwrite.
|
||||
//! \~russian Вставляет все элементы `other` этот массив с перезаписью.
|
||||
inline PIMap<Key, T> & operator <<(const PIMap<Key, T> & other) {
|
||||
#ifndef NDEBUG
|
||||
if (&other == this) {
|
||||
@@ -301,12 +338,20 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool operator ==(const PIMap<Key, T> & t) const {
|
||||
return (pim_content == t.pim_content && pim_index == t.pim_index);
|
||||
//! \~english Compare operator with array `m`.
|
||||
//! \~russian Оператор сравнения с массивом `m`.
|
||||
inline bool operator ==(const PIMap<Key, T> & m) const {
|
||||
return (pim_content == m.pim_content && pim_index == m.pim_index);
|
||||
}
|
||||
inline bool operator !=(const PIMap<Key, T> & t) const {
|
||||
return (pim_content != t.pim_content || pim_index != t.pim_index);
|
||||
|
||||
//! \~english Compare operator with array `m`.
|
||||
//! \~russian Оператор сравнения с массивом `m`.
|
||||
inline bool operator !=(const PIMap<Key, T> & m) const {
|
||||
return (pim_content != m.pim_content || pim_index != m.pim_index);
|
||||
}
|
||||
|
||||
//! \~english Tests if element with key `key` exists in the array.
|
||||
//! \~russian Проверяет наличие элемента с ключом `key` в массиве.
|
||||
inline bool contains(const Key & key) const {
|
||||
bool f(false); _find(key, f);
|
||||
return f;
|
||||
|
||||
@@ -250,7 +250,7 @@ PIStringList PIObject::methodsEH() const {
|
||||
PIMutexLocker ml(__meta_mutex());
|
||||
PIStringList ret;
|
||||
const __MetaData & ehd(__meta_data()[classNameID()]);
|
||||
for (auto eh = ehd.eh_func.constBegin(); eh != ehd.eh_func.constEnd(); eh++)
|
||||
for (auto eh = ehd.eh_func.begin(); eh != ehd.eh_func.end(); eh++)
|
||||
ret << eh.value().fullFormat();
|
||||
return ret;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ bool PIObject::isMethodEHContains(const PIString & name) const {
|
||||
uint search_id = name.hash();
|
||||
PIMutexLocker ml(__meta_mutex());
|
||||
const __MetaData & ehd(__meta_data()[classNameID()]);
|
||||
for (auto eh = ehd.eh_func.constBegin(); eh != ehd.eh_func.constEnd(); eh++) {
|
||||
for (auto eh = ehd.eh_func.begin(); eh != ehd.eh_func.end(); eh++) {
|
||||
if (eh.value().func_name_id == search_id)
|
||||
return true;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ PIString PIObject::methodEHArguments(const PIString & name) const {
|
||||
uint search_id = name.hash();
|
||||
PIMutexLocker ml(__meta_mutex());
|
||||
const __MetaData & ehd(__meta_data()[classNameID()]);
|
||||
for (auto eh = ehd.eh_func.constBegin(); eh != ehd.eh_func.constEnd(); eh++) {
|
||||
for (auto eh = ehd.eh_func.begin(); eh != ehd.eh_func.end(); eh++) {
|
||||
if (eh.value().func_name_id == search_id)
|
||||
return eh.value().arguments();
|
||||
}
|
||||
@@ -284,7 +284,7 @@ PIString PIObject::methodEHFullFormat(const PIString & name) const {
|
||||
uint search_id = name.hash();
|
||||
PIMutexLocker ml(__meta_mutex());
|
||||
const __MetaData & ehd(__meta_data()[classNameID()]);
|
||||
for (auto eh = ehd.eh_func.constBegin(); eh != ehd.eh_func.constEnd(); eh++) {
|
||||
for (auto eh = ehd.eh_func.begin(); eh != ehd.eh_func.end(); eh++) {
|
||||
if (eh.value().func_name_id == search_id)
|
||||
return eh.value().fullFormat();
|
||||
}
|
||||
@@ -301,7 +301,7 @@ PIVector<PIObject::__MetaFunc> PIObject::findEH(const PIString & name) const {
|
||||
uint search_id = name.hash();
|
||||
PIVector<__MetaFunc> ret;
|
||||
const __MetaData & ehd(__meta_data()[classNameID()]);
|
||||
for (auto eh = ehd.eh_func.constBegin(); eh != ehd.eh_func.constEnd(); eh++) {
|
||||
for (auto eh = ehd.eh_func.begin(); eh != ehd.eh_func.end(); eh++) {
|
||||
if (eh.value().func_name_id == search_id)
|
||||
ret << eh.value();
|
||||
}
|
||||
@@ -687,7 +687,7 @@ void PIObject::dump(const PIString & line_prefix) const {
|
||||
const __MetaData & ehd(__meta_data()[classNameID()]);
|
||||
PICout(PICoutManipulators::AddNewLine) << line_prefix << " count: " << ehd.eh_func.size_s();
|
||||
//printf("dump %d methods\n", ehd.eh_func.size());
|
||||
for (auto eh = ehd.eh_func.constBegin(); eh != ehd.eh_func.constEnd(); eh++) {
|
||||
for (auto eh = ehd.eh_func.begin(); eh != ehd.eh_func.end(); eh++) {
|
||||
PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << eh.value().fullFormat();
|
||||
}
|
||||
//printf("dump %d methods ok\n", ehd.eh_func.size());
|
||||
|
||||
@@ -378,14 +378,14 @@ bool PIConnection::removeDevice(const PIString & full_path) {
|
||||
for (const PIString & n : dntd) {
|
||||
device_names.remove(n);
|
||||
}
|
||||
for (auto s = senders.constBegin(); s != senders.constEnd(); s++) {
|
||||
for (auto s = senders.begin(); s != senders.end(); s++) {
|
||||
if (!s.value()) continue;
|
||||
s.value()->lock();
|
||||
s.value()->devices.removeAll(dev);
|
||||
s.value()->unlock();
|
||||
}
|
||||
device_modes.remove(dev);
|
||||
for (auto i = extractors.constBegin(); i != extractors.constEnd(); i++) {
|
||||
for (auto i = extractors.begin(); i != extractors.end(); i++) {
|
||||
if (!i.value()) continue;
|
||||
i.value()->devices.removeAll(dev);
|
||||
}
|
||||
@@ -409,7 +409,7 @@ void PIConnection::removeAllDevices() {
|
||||
PIVector<PIIODevice * > bdevs(__device_pool__->boundedDevices(this));
|
||||
__device_pool__->lock();
|
||||
for (PIIODevice * d : bdevs) {
|
||||
for (auto s = senders.constBegin(); s != senders.constEnd(); s++) {
|
||||
for (auto s = senders.begin(); s != senders.end(); s++) {
|
||||
if (!s.value()) continue;
|
||||
s.value()->lock();
|
||||
s.value()->devices.removeAll(d);
|
||||
@@ -428,7 +428,7 @@ void PIConnection::removeAllDevices() {
|
||||
__device_pool__->unlock();
|
||||
device_modes.clear();
|
||||
bounded_extractors.clear();
|
||||
for (auto i = extractors.constBegin(); i != extractors.constEnd(); i++) {
|
||||
for (auto i = extractors.begin(); i != extractors.end(); i++) {
|
||||
if (!i.value()) continue;
|
||||
i.value()->devices.clear();
|
||||
}
|
||||
@@ -567,7 +567,7 @@ bool PIConnection::removeFilter(const PIString & name_) {
|
||||
|
||||
void PIConnection::removeAllFilters() {
|
||||
__device_pool__->lock();
|
||||
for (auto i = extractors.constBegin(); i != extractors.constEnd(); i++) {
|
||||
for (auto i = extractors.begin(); i != extractors.end(); i++) {
|
||||
if (!i.value()) continue;
|
||||
channels_.remove(i.value()->extractor);
|
||||
auto it = channels_.makeIterator();
|
||||
@@ -588,7 +588,7 @@ void PIConnection::removeAllFilters() {
|
||||
|
||||
PIVector<PIPacketExtractor * > PIConnection::filters() const {
|
||||
PIVector<PIPacketExtractor * > ret;
|
||||
for (auto i = extractors.constBegin(); i != extractors.constEnd(); i++) {
|
||||
for (auto i = extractors.begin(); i != extractors.end(); i++) {
|
||||
if (i.value()) {
|
||||
if (i.value()->extractor) ret << i.value()->extractor;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ PIVector<PIPacketExtractor * > PIConnection::filters() const {
|
||||
|
||||
PIStringList PIConnection::filterNames() const {
|
||||
PIStringList ret;
|
||||
for (auto i = extractors.constBegin(); i != extractors.constEnd(); i++) {
|
||||
for (auto i = extractors.begin(); i != extractors.end(); i++) {
|
||||
if (i.value())
|
||||
if (i.value()->extractor) ret << i.key();
|
||||
}
|
||||
@@ -609,7 +609,7 @@ PIStringList PIConnection::filterNames() const {
|
||||
|
||||
PIPacketExtractor * PIConnection::filter(const PIString & name_) const {
|
||||
PIString fname_ = name_.trimmed();
|
||||
for (auto i = extractors.constBegin(); i != extractors.constEnd(); i++) {
|
||||
for (auto i = extractors.begin(); i != extractors.end(); i++) {
|
||||
if (i.value()) {
|
||||
if ((i.value()->extractor) && (i.key() == fname_)) return i.value()->extractor;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ float PIConnection::senderFrequency(const PIString & name) const {
|
||||
|
||||
|
||||
void PIConnection::removeAllSenders() {
|
||||
for (auto s = senders.constBegin(); s != senders.constEnd(); s++) {
|
||||
for (auto s = senders.begin(); s != senders.end(); s++) {
|
||||
if (s.value()) delete s.value();
|
||||
}
|
||||
senders.clear();
|
||||
@@ -824,7 +824,7 @@ void PIConnection::startThreadedRead(const PIString & full_path_name) {
|
||||
|
||||
|
||||
void PIConnection::startAllThreadedReads() {
|
||||
for (auto d = __device_pool__->devices.constBegin(); d != __device_pool__->devices.constEnd(); d++) {
|
||||
for (auto d = __device_pool__->devices.begin(); d != __device_pool__->devices.end(); d++) {
|
||||
startThreadedRead(d.key());
|
||||
}
|
||||
}
|
||||
@@ -838,7 +838,7 @@ void PIConnection::startSender(const PIString & name) {
|
||||
|
||||
|
||||
void PIConnection::startAllSenders() {
|
||||
for (auto s = senders.constBegin(); s != senders.constEnd(); s++) {
|
||||
for (auto s = senders.begin(); s != senders.end(); s++) {
|
||||
if (!s.value()) continue;
|
||||
if (!s.value()->isRunning() && !__device_pool__->fake) {
|
||||
s.value()->start(s.value()->int_);
|
||||
@@ -858,7 +858,7 @@ void PIConnection::stopThreadedRead(const PIString & full_path_name) {
|
||||
|
||||
|
||||
void PIConnection::stopAllThreadedReads() {
|
||||
for (auto d = __device_pool__->devices.constBegin(); d != __device_pool__->devices.constEnd(); d++) {
|
||||
for (auto d = __device_pool__->devices.begin(); d != __device_pool__->devices.end(); d++) {
|
||||
stopThreadedRead(d.key());
|
||||
}
|
||||
}
|
||||
@@ -872,7 +872,7 @@ void PIConnection::stopSender(const PIString & name) {
|
||||
|
||||
|
||||
void PIConnection::stopAllSenders() {
|
||||
for (auto s = senders.constBegin(); s != senders.constEnd(); s++) {
|
||||
for (auto s = senders.begin(); s != senders.end(); s++) {
|
||||
if (!s.value()) continue;
|
||||
if (s.value()->isRunning()) s.value()->stop();
|
||||
}
|
||||
@@ -1032,7 +1032,7 @@ bool PIConnection::DevicePool::removeDevice(PIConnection * parent, const PIStrin
|
||||
|
||||
void PIConnection::DevicePool::unboundConnection(PIConnection * parent) {
|
||||
PIStringList rem;
|
||||
for (auto i = devices.constBegin(); i != devices.constEnd(); i++) {
|
||||
for (auto i = devices.begin(); i != devices.end(); i++) {
|
||||
if (!i.value()) {
|
||||
rem << i.key();
|
||||
continue;
|
||||
@@ -1129,7 +1129,7 @@ PIConnection::DevicePool::DeviceData::~DeviceData() {
|
||||
void PIConnection::DevicePool::run() {
|
||||
PIVector<PIConnection * > conns(PIConnection::allConnections());
|
||||
for (PIConnection * c : conns) {
|
||||
for (auto d = c->diags_.constBegin(); d != c->diags_.constEnd(); d++) {
|
||||
for (auto d = c->diags_.begin(); d != c->diags_.end(); d++) {
|
||||
if (!d.value()) continue;
|
||||
d.value()->tick(0, 1);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
" | p = " + PIString::fromNumber(a.ping) +
|
||||
" | a = " + PIString::fromBool(a.isAvailable()), CellFormat());
|
||||
PIStringList peermap;
|
||||
for (auto p = daemon_._peerMap().constBegin(); p != daemon_._peerMap().constEnd(); p++) {
|
||||
for (auto p = daemon_._peerMap().begin(); p != daemon_._peerMap().end(); p++) {
|
||||
PIString s = p.key() + " | ";
|
||||
piForeachCR(PIPeer::PeerInfo * pp, p.value()) s += " -> " + pp->name;
|
||||
peermap << s;
|
||||
|
||||
Reference in New Issue
Block a user