2014-09-06 09:21:19 +08:00
|
|
|
//===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBThreadCollection.h"
|
|
|
|
#include "lldb/API/SBThread.h"
|
|
|
|
#include "lldb/Target/ThreadList.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBThreadCollection::SBThreadCollection() : m_opaque_sp() {}
|
2014-09-06 09:21:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs)
|
|
|
|
: m_opaque_sp(rhs.m_opaque_sp) {}
|
2014-09-06 09:21:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const SBThreadCollection &SBThreadCollection::
|
|
|
|
operator=(const SBThreadCollection &rhs) {
|
|
|
|
if (this != &rhs)
|
|
|
|
m_opaque_sp = rhs.m_opaque_sp;
|
|
|
|
return *this;
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
|
|
|
|
: m_opaque_sp(threads) {}
|
2014-09-06 09:21:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBThreadCollection::~SBThreadCollection() {}
|
2014-09-06 09:21:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
|
|
|
|
m_opaque_sp = threads;
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::ThreadCollection *SBThreadCollection::get() const {
|
|
|
|
return m_opaque_sp.get();
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::ThreadCollection *SBThreadCollection::operator->() const {
|
|
|
|
return m_opaque_sp.operator->();
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::ThreadCollectionSP &SBThreadCollection::operator*() {
|
|
|
|
return m_opaque_sp;
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
|
|
|
|
return m_opaque_sp;
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; }
|
2014-09-06 09:21:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t SBThreadCollection::GetSize() {
|
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->GetSize();
|
|
|
|
return 0;
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBThread SBThreadCollection::GetThreadAtIndex(size_t idx) {
|
|
|
|
SBThread thread;
|
|
|
|
if (m_opaque_sp && idx < m_opaque_sp->GetSize())
|
|
|
|
thread = m_opaque_sp->GetThreadAtIndex(idx);
|
|
|
|
return thread;
|
2014-09-06 09:21:19 +08:00
|
|
|
}
|