17aa51b79SEd Maste //===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===// 27aa51b79SEd Maste // 37aa51b79SEd Maste // The LLVM Compiler Infrastructure 47aa51b79SEd Maste // 57aa51b79SEd Maste // This file is distributed under the University of Illinois Open Source 67aa51b79SEd Maste // License. See LICENSE.TXT for details. 77aa51b79SEd Maste // 87aa51b79SEd Maste //===----------------------------------------------------------------------===// 97aa51b79SEd Maste 107aa51b79SEd Maste #include "lldb/API/SBThreadCollection.h" 117aa51b79SEd Maste #include "lldb/API/SBThread.h" 127aa51b79SEd Maste #include "lldb/Target/ThreadList.h" 137aa51b79SEd Maste 147aa51b79SEd Maste using namespace lldb; 157aa51b79SEd Maste using namespace lldb_private; 167aa51b79SEd Maste SBThreadCollection()17*435933ddSDimitry AndricSBThreadCollection::SBThreadCollection() : m_opaque_sp() {} 187aa51b79SEd Maste SBThreadCollection(const SBThreadCollection & rhs)19*435933ddSDimitry AndricSBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs) 20*435933ddSDimitry Andric : m_opaque_sp(rhs.m_opaque_sp) {} 217aa51b79SEd Maste 22*435933ddSDimitry Andric const SBThreadCollection &SBThreadCollection:: operator =(const SBThreadCollection & rhs)23*435933ddSDimitry Andricoperator=(const SBThreadCollection &rhs) { 247aa51b79SEd Maste if (this != &rhs) 257aa51b79SEd Maste m_opaque_sp = rhs.m_opaque_sp; 267aa51b79SEd Maste return *this; 277aa51b79SEd Maste } 287aa51b79SEd Maste SBThreadCollection(const ThreadCollectionSP & threads)29*435933ddSDimitry AndricSBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads) 30*435933ddSDimitry Andric : m_opaque_sp(threads) {} 317aa51b79SEd Maste ~SBThreadCollection()32*435933ddSDimitry AndricSBThreadCollection::~SBThreadCollection() {} 337aa51b79SEd Maste SetOpaque(const lldb::ThreadCollectionSP & threads)34*435933ddSDimitry Andricvoid SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) { 357aa51b79SEd Maste m_opaque_sp = threads; 367aa51b79SEd Maste } 377aa51b79SEd Maste get() const38*435933ddSDimitry Andriclldb_private::ThreadCollection *SBThreadCollection::get() const { 397aa51b79SEd Maste return m_opaque_sp.get(); 407aa51b79SEd Maste } 417aa51b79SEd Maste operator ->() const42*435933ddSDimitry Andriclldb_private::ThreadCollection *SBThreadCollection::operator->() const { 437aa51b79SEd Maste return m_opaque_sp.operator->(); 447aa51b79SEd Maste } 457aa51b79SEd Maste operator *()46*435933ddSDimitry Andriclldb::ThreadCollectionSP &SBThreadCollection::operator*() { 477aa51b79SEd Maste return m_opaque_sp; 487aa51b79SEd Maste } 497aa51b79SEd Maste operator *() const50*435933ddSDimitry Andricconst lldb::ThreadCollectionSP &SBThreadCollection::operator*() const { 517aa51b79SEd Maste return m_opaque_sp; 527aa51b79SEd Maste } 537aa51b79SEd Maste IsValid() const54*435933ddSDimitry Andricbool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; } 557aa51b79SEd Maste GetSize()56*435933ddSDimitry Andricsize_t SBThreadCollection::GetSize() { 577aa51b79SEd Maste if (m_opaque_sp) 587aa51b79SEd Maste return m_opaque_sp->GetSize(); 597aa51b79SEd Maste return 0; 607aa51b79SEd Maste } 617aa51b79SEd Maste GetThreadAtIndex(size_t idx)62*435933ddSDimitry AndricSBThread SBThreadCollection::GetThreadAtIndex(size_t idx) { 637aa51b79SEd Maste SBThread thread; 647aa51b79SEd Maste if (m_opaque_sp && idx < m_opaque_sp->GetSize()) 657aa51b79SEd Maste thread = m_opaque_sp->GetThreadAtIndex(idx); 667aa51b79SEd Maste return thread; 677aa51b79SEd Maste } 68