Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2D/MacroSceneLayer.h @ 1793:c5e6379b9cd0
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 17 May 2021 17:23:54 +0200 |
parents | 9b650ab68d4c |
children | 20a0aba0ede5 |
comparison
equal
deleted
inserted
replaced
1792:373d7f7e796e | 1793:c5e6379b9cd0 |
---|---|
24 | 24 |
25 #include "ISceneLayer.h" | 25 #include "ISceneLayer.h" |
26 | 26 |
27 #include <Compatibility.h> // For ORTHANC_OVERRIDE | 27 #include <Compatibility.h> // For ORTHANC_OVERRIDE |
28 | 28 |
29 #include <vector> | 29 #include <deque> |
30 | 30 |
31 namespace OrthancStone | 31 namespace OrthancStone |
32 { | 32 { |
33 /** | 33 /** |
34 * A "macro layer" is a group of sublayers that are handled as a | 34 * A "macro layer" is a group of sublayers that are handled as a |
35 * whole, and that share the same depth in the scene. | 35 * whole, and that share the same depth in the scene. |
36 **/ | 36 **/ |
37 class MacroSceneLayer : public ISceneLayer | 37 class MacroSceneLayer : public ISceneLayer |
38 { | 38 { |
39 private: | 39 private: |
40 std::vector<ISceneLayer*> layers_; | 40 // A deque is used because we need to quickly add new layers, and |
41 uint64_t revision_; | 41 // to randomly access the layers |
42 std::deque<ISceneLayer*> layers_; | |
43 uint64_t revision_; | |
42 | 44 |
43 protected: | 45 protected: |
44 void BumpRevision() | 46 void BumpRevision() |
45 { | 47 { |
46 // this is *not* thread-safe!!! => (SJO) no problem, Stone assumes mono-threading | 48 // this is *not* thread-safe!!! => (SJO) no problem, Stone assumes mono-threading |
58 Clear(); | 60 Clear(); |
59 } | 61 } |
60 | 62 |
61 void Clear(); | 63 void Clear(); |
62 | 64 |
63 void Reserve(size_t size) | 65 size_t AddLayer(ISceneLayer* layer); // takes ownership |
64 { | |
65 layers_.reserve(size); | |
66 } | |
67 | |
68 void AddLayer(ISceneLayer* layer); // takes ownership | |
69 | 66 |
70 size_t GetSize() const | 67 size_t GetSize() const |
71 { | 68 { |
72 return layers_.size(); | 69 return layers_.size(); |
73 } | 70 } |