SBThreadCollection.cpp revision 278332
1278332Semaste//===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===// 2278332Semaste// 3278332Semaste// The LLVM Compiler Infrastructure 4278332Semaste// 5278332Semaste// This file is distributed under the University of Illinois Open Source 6278332Semaste// License. See LICENSE.TXT for details. 7278332Semaste// 8278332Semaste//===----------------------------------------------------------------------===// 9278332Semaste 10278332Semaste#include "lldb/API/SBThreadCollection.h" 11278332Semaste#include "lldb/API/SBThread.h" 12278332Semaste#include "lldb/Target/ThreadList.h" 13278332Semaste 14278332Semasteusing namespace lldb; 15278332Semasteusing namespace lldb_private; 16278332Semaste 17278332Semaste 18278332SemasteSBThreadCollection::SBThreadCollection () : 19278332Semaste m_opaque_sp() 20278332Semaste{ 21278332Semaste} 22278332Semaste 23278332SemasteSBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs) : 24278332Semaste m_opaque_sp (rhs.m_opaque_sp) 25278332Semaste{ 26278332Semaste} 27278332Semaste 28278332Semasteconst SBThreadCollection & 29278332SemasteSBThreadCollection::operator = (const SBThreadCollection &rhs) 30278332Semaste{ 31278332Semaste if (this != &rhs) 32278332Semaste m_opaque_sp = rhs.m_opaque_sp; 33278332Semaste return *this; 34278332Semaste} 35278332Semaste 36278332SemasteSBThreadCollection::SBThreadCollection (const ThreadCollectionSP &threads) : 37278332Semaste m_opaque_sp(threads) 38278332Semaste{ 39278332Semaste} 40278332Semaste 41278332SemasteSBThreadCollection::~SBThreadCollection () 42278332Semaste{ 43278332Semaste} 44278332Semaste 45278332Semastevoid 46278332SemasteSBThreadCollection::SetOpaque (const lldb::ThreadCollectionSP &threads) 47278332Semaste{ 48278332Semaste m_opaque_sp = threads; 49278332Semaste} 50278332Semaste 51278332Semastelldb_private::ThreadCollection * 52278332SemasteSBThreadCollection::get() const 53278332Semaste{ 54278332Semaste return m_opaque_sp.get(); 55278332Semaste} 56278332Semaste 57278332Semastelldb_private::ThreadCollection * 58278332SemasteSBThreadCollection::operator->() const 59278332Semaste{ 60278332Semaste return m_opaque_sp.operator->(); 61278332Semaste} 62278332Semaste 63278332Semastelldb::ThreadCollectionSP & 64278332SemasteSBThreadCollection::operator*() 65278332Semaste{ 66278332Semaste return m_opaque_sp; 67278332Semaste} 68278332Semaste 69278332Semasteconst lldb::ThreadCollectionSP & 70278332SemasteSBThreadCollection::operator*() const 71278332Semaste{ 72278332Semaste return m_opaque_sp; 73278332Semaste} 74278332Semaste 75278332Semaste 76278332Semastebool 77278332SemasteSBThreadCollection::IsValid () const 78278332Semaste{ 79278332Semaste return m_opaque_sp.get() != NULL; 80278332Semaste} 81278332Semaste 82278332Semastesize_t 83278332SemasteSBThreadCollection::GetSize () 84278332Semaste{ 85278332Semaste if (m_opaque_sp) 86278332Semaste return m_opaque_sp->GetSize(); 87278332Semaste return 0; 88278332Semaste} 89278332Semaste 90278332SemasteSBThread 91278332SemasteSBThreadCollection::GetThreadAtIndex(size_t idx) 92278332Semaste{ 93278332Semaste SBThread thread; 94278332Semaste if (m_opaque_sp && idx < m_opaque_sp->GetSize()) 95278332Semaste thread = m_opaque_sp->GetThreadAtIndex(idx); 96278332Semaste return thread; 97278332Semaste} 98