blob: c424d47b40981f88dc3ee5a7a0994a9166125193 [file] [log] [blame]
Kuba Breckaa5ea1e22014-09-06 01:21:191//===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "lldb/API/SBThreadCollection.h"
11#include "lldb/API/SBThread.h"
12#include "lldb/Target/ThreadList.h"
13
14using namespace lldb;
15using namespace lldb_private;
16
Kate Stoneb9c1b512016-09-06 20:57:5017SBThreadCollection::SBThreadCollection() : m_opaque_sp() {}
Kuba Breckaa5ea1e22014-09-06 01:21:1918
Kate Stoneb9c1b512016-09-06 20:57:5019SBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs)
20 : m_opaque_sp(rhs.m_opaque_sp) {}
21
22const SBThreadCollection &SBThreadCollection::
23operator=(const SBThreadCollection &rhs) {
24 if (this != &rhs)
25 m_opaque_sp = rhs.m_opaque_sp;
26 return *this;
Kuba Breckaa5ea1e22014-09-06 01:21:1927}
28
Kate Stoneb9c1b512016-09-06 20:57:5029SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
30 : m_opaque_sp(threads) {}
31
32SBThreadCollection::~SBThreadCollection() {}
33
34void SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
35 m_opaque_sp = threads;
Kuba Breckaa5ea1e22014-09-06 01:21:1936}
37
Kate Stoneb9c1b512016-09-06 20:57:5038lldb_private::ThreadCollection *SBThreadCollection::get() const {
39 return m_opaque_sp.get();
Kuba Breckaa5ea1e22014-09-06 01:21:1940}
41
Kate Stoneb9c1b512016-09-06 20:57:5042lldb_private::ThreadCollection *SBThreadCollection::operator->() const {
43 return m_opaque_sp.operator->();
Kuba Breckaa5ea1e22014-09-06 01:21:1944}
45
Kate Stoneb9c1b512016-09-06 20:57:5046lldb::ThreadCollectionSP &SBThreadCollection::operator*() {
47 return m_opaque_sp;
Kuba Breckaa5ea1e22014-09-06 01:21:1948}
49
Kate Stoneb9c1b512016-09-06 20:57:5050const lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
51 return m_opaque_sp;
Kuba Breckaa5ea1e22014-09-06 01:21:1952}
53
Kate Stoneb9c1b512016-09-06 20:57:5054bool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; }
55
56size_t SBThreadCollection::GetSize() {
57 if (m_opaque_sp)
58 return m_opaque_sp->GetSize();
59 return 0;
Kuba Breckaa5ea1e22014-09-06 01:21:1960}
61
Kate Stoneb9c1b512016-09-06 20:57:5062SBThread SBThreadCollection::GetThreadAtIndex(size_t idx) {
63 SBThread thread;
64 if (m_opaque_sp && idx < m_opaque_sp->GetSize())
65 thread = m_opaque_sp->GetThreadAtIndex(idx);
66 return thread;
Kuba Breckaa5ea1e22014-09-06 01:21:1967}