1// tSelection.h 
2// 
3// This file implements scene selection sets. A selection is simply a collection of scene instances referenced by ID. 
4// 
5// Copyright (c) 2006, 2017 Tristan Grimmer. 
6// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby 
7// granted, provided that the above copyright notice and this permission notice appear in all copies. 
8// 
9// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 
10// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 
11// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
12// AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
13// PERFORMANCE OF THIS SOFTWARE. 
14 
15#pragma once 
16#include <Scene/tObject.h> 
17namespace tScene 
18
19 
20 
21class tSelection : public tObject 
22
23public
24 tSelection() { } 
25 tSelection(const tChunk& chunk) { Load(chunk); } 
26 virtual ~tSelection() { } 
27 
28 bool ContainsInstance(uint32 instID) const
29 int GetNumItems() const { return InstanceIDs.GetNumItems(); } 
30 void Clear() { tObject::Clear(); InstanceIDs.Empty(); } 
31 
32 void Save(tChunkWriter&) const
33 void Load(const tChunk&); 
34 
35 tItList<uint32> InstanceIDs
36}; 
37 
38 
39// Implementation below this line. 
40 
41 
42inline bool tSelection::ContainsInstance(uint32 instID) const 
43
44 for (tItList<uint32>::Iter i = InstanceIDs.First(); i; ++i
45 if (*i.GetObject() == instID
46 return true
47 
48 return false
49
50 
51 
52
53