SBThreadCollection.cpp revision 314564
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
17314564SdimSBThreadCollection::SBThreadCollection() : m_opaque_sp() {}
18278332Semaste
19314564SdimSBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs)
20314564Sdim    : m_opaque_sp(rhs.m_opaque_sp) {}
21278332Semaste
22314564Sdimconst SBThreadCollection &SBThreadCollection::
23314564Sdimoperator=(const SBThreadCollection &rhs) {
24314564Sdim  if (this != &rhs)
25314564Sdim    m_opaque_sp = rhs.m_opaque_sp;
26314564Sdim  return *this;
27278332Semaste}
28278332Semaste
29314564SdimSBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
30314564Sdim    : m_opaque_sp(threads) {}
31278332Semaste
32314564SdimSBThreadCollection::~SBThreadCollection() {}
33278332Semaste
34314564Sdimvoid SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
35314564Sdim  m_opaque_sp = threads;
36278332Semaste}
37278332Semaste
38314564Sdimlldb_private::ThreadCollection *SBThreadCollection::get() const {
39314564Sdim  return m_opaque_sp.get();
40278332Semaste}
41278332Semaste
42314564Sdimlldb_private::ThreadCollection *SBThreadCollection::operator->() const {
43314564Sdim  return m_opaque_sp.operator->();
44278332Semaste}
45278332Semaste
46314564Sdimlldb::ThreadCollectionSP &SBThreadCollection::operator*() {
47314564Sdim  return m_opaque_sp;
48278332Semaste}
49278332Semaste
50314564Sdimconst lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
51314564Sdim  return m_opaque_sp;
52278332Semaste}
53278332Semaste
54314564Sdimbool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; }
55278332Semaste
56314564Sdimsize_t SBThreadCollection::GetSize() {
57314564Sdim  if (m_opaque_sp)
58314564Sdim    return m_opaque_sp->GetSize();
59314564Sdim  return 0;
60278332Semaste}
61278332Semaste
62314564SdimSBThread SBThreadCollection::GetThreadAtIndex(size_t idx) {
63314564Sdim  SBThread thread;
64314564Sdim  if (m_opaque_sp && idx < m_opaque_sp->GetSize())
65314564Sdim    thread = m_opaque_sp->GetThreadAtIndex(idx);
66314564Sdim  return thread;
67278332Semaste}
68