GCC Code Coverage Report


Directory: ./
File: libs/viz/scene3d/factory/new.hpp
Date: 2024-04-24 14:25:45
Exec Total Coverage
Lines: 6 8 75.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /************************************************************************
2 *
3 * Copyright (C) 2014-2024 IRCAD France
4 * Copyright (C) 2014-2021 IHU Strasbourg
5 *
6 * This file is part of Sight.
7 *
8 * Sight is free software: you can redistribute it and/or modify it under
9 * the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Sight is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
20 *
21 ***********************************************************************/
22
23 #pragma once
24
25 #include <sight/viz/scene3d/config.hpp>
26
27 #include "viz/scene3d/registry/detail.hpp"
28
29 #include <string>
30
31 namespace sight::viz::scene3d
32 {
33
34 class window_interactor;
35 class light_adaptor;
36 class text;
37 class layer;
38
39 namespace factory
40 {
41
42 template<class CLASSNAME>
43 SPTR(CLASSNAME) make();
44
45 SIGHT_VIZ_SCENE3D_API SPTR(viz::scene3d::window_interactor) make(
46 const viz::scene3d::registry::key_t& _classname
47 );
48
49 template<class CLASSNAME>
50 46 SPTR(CLASSNAME) make()
51 {
52 SPTR(CLASSNAME) obj = std::make_shared<CLASSNAME>();
53 46 return obj;
54 }
55
56 } // namespace factory
57
58 namespace offscreen_interactor_mgr_factory
59 {
60
61 template<class CLASSNAME>
62 SPTR(CLASSNAME) make(std::pair<unsigned int, unsigned int> _dims);
63
64 SIGHT_VIZ_SCENE3D_API SPTR(viz::scene3d::window_interactor) make(
65 const viz::scene3d::registry::key_t& _classname,
66 std::pair<unsigned int, unsigned int> _dims
67 );
68
69 template<class CLASSNAME>
70 SPTR(CLASSNAME) make(std::pair<unsigned int, unsigned int> _dims)
71 {
72 return std::make_shared<CLASSNAME>(_dims.first, _dims.second);
73 }
74
75 } // namespace offscreenInteractorMgrFactory
76
77 namespace light_factory
78 {
79
80 template<class CLASSNAME>
81 SPTR(CLASSNAME) make();
82
83 SIGHT_VIZ_SCENE3D_API SPTR(viz::scene3d::light_adaptor) make(
84 const viz::scene3d::registry::key_t& _classname
85 );
86
87 template<class CLASSNAME>
88 68 SPTR(CLASSNAME) make()
89 {
90 SPTR(CLASSNAME) obj = std::make_shared<CLASSNAME>();
91 68 return obj;
92 }
93
94 } // namespace lightFactory
95
96 namespace text_factory
97 {
98
99 template<class CLASSNAME>
100 SPTR(CLASSNAME) make(const SPTR(sight::viz::scene3d::layer) & _layer);
101
102 SIGHT_VIZ_SCENE3D_API SPTR(viz::scene3d::text) make(
103 const viz::scene3d::registry::key_t& _classname,
104 const SPTR(sight::viz::scene3d::layer) & _layer
105 );
106
107 template<class CLASSNAME>
108 57 SPTR(CLASSNAME) make(const SPTR(sight::viz::scene3d::layer) & _layer)
109 {
110 57 SPTR(CLASSNAME) obj = std::make_shared<CLASSNAME>(_layer);
111 return obj;
112 }
113
114 } // namespace textFactory
115
116 } // namespace sight::viz::scene3d
117