1 //===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/API/SBThreadCollection.h"
11 #include "lldb/API/SBThread.h"
12 #include "lldb/Target/ThreadList.h"
15 using namespace lldb_private;
17 SBThreadCollection::SBThreadCollection() : m_opaque_sp() {}
19 SBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs)
20 : m_opaque_sp(rhs.m_opaque_sp) {}
22 const SBThreadCollection &SBThreadCollection::
23 operator=(const SBThreadCollection &rhs) {
25 m_opaque_sp = rhs.m_opaque_sp;
29 SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
30 : m_opaque_sp(threads) {}
32 SBThreadCollection::~SBThreadCollection() {}
34 void SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
35 m_opaque_sp = threads;
38 lldb_private::ThreadCollection *SBThreadCollection::get() const {
39 return m_opaque_sp.get();
42 lldb_private::ThreadCollection *SBThreadCollection::operator->() const {
43 return m_opaque_sp.operator->();
46 lldb::ThreadCollectionSP &SBThreadCollection::operator*() {
50 const lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
54 bool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; }
56 size_t SBThreadCollection::GetSize() {
58 return m_opaque_sp->GetSize();
62 SBThread SBThreadCollection::GetThreadAtIndex(size_t idx) {
64 if (m_opaque_sp && idx < m_opaque_sp->GetSize())
65 thread = m_opaque_sp->GetThreadAtIndex(idx);