vsg: include/vsg/nodes/InstrumentationNode.h Source File

vsg 1.1.10 VulkanSceneGraph library |

Loading...
Searching...
No Matches
InstrumentationNode.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2024 Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/maths/sphere.h>
16#include <vsg/nodes/Node.h>
17#include <vsg/utils/Instrumentation.h>
18
19namespace vsg
20{
21
23 class VSG_DECLSPEC InstrumentationNode : public Inherit<Node, InstrumentationNode>
24 {
25 public:
26 InstrumentationNode();
27 InstrumentationNode(const InstrumentationNode& rhs, const CopyOp& copyop = {});
28 explicit InstrumentationNode(ref_ptr<Node> in_child);
29
30 void setColor(uint_color color);
31 uint_color getColor() const { return _color; }
32
33 void setName(const std::string& name);
34 const std::string& getName() const { return _name; }
35
36 void setLevel(uint32_t level);
37 uint32_t getLevel() const { return _level; }
38
39 ref_ptr<vsg::Node> child;
40
41 public:
42 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return InstrumentationNode::create(*this, copyop); }
43 int compare(const Object& rhs) const override;
44
45 void traverse(Visitor& visitor) override;
46 void traverse(ConstVisitor& visitor) const override;
47 void traverse(RecordTraversal& visitor) const override;
48
49 void read(Input& input) override;
50 void write(Output& output) const override;
51
52 protected:
53 virtual ~InstrumentationNode();
54
55 uint32_t _level = 1;
56 uint_color _color;
57 std::string _name;
58
59 // SourceLocation variants for passing to Instrumentation that adapt the level, color and name to work with SourceLocation usad by Instrumentation
60 SourceLocation _sl_Visitor;
61 SourceLocation _sl_ConstVisitor;
62 SourceLocation _sl_RecordTraversal;
63 };
64 VSG_type_name(vsg::InstrumentationNode);
65
66} // namespace vsg
vsg::ConstVisitor
Definition ConstVisitor.h:175
vsg::CopyOp
Definition Object.h:42
vsg::Input
Definition Input.h:44
vsg::InstrumentationNode
InstrumentationNode enables instrumentation of a subgraph.
Definition InstrumentationNode.h:24
vsg::InstrumentationNode::compare
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
vsg::InstrumentationNode::clone
ref_ptr< Object > clone(const CopyOp &copyop={}) const override
Definition InstrumentationNode.h:42
vsg::Object
Definition Object.h:60
vsg::Output
Definition Output.h:41
vsg::RecordTraversal
RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to rec...
Definition RecordTraversal.h:70
vsg::Visitor
Definition Visitor.h:175
vsg::ref_ptr
Definition ref_ptr.h:22
vsg::SourceLocation
Definition Instrumentation.h:40
vsg::uint_color
uint_color struct used to provide a {r, g, b, a} interface a colors assigned as uint32_t
Definition Instrumentation.h:29