PLaSK library
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef PLASK__GEOMETRY_UTILS_H
15#define PLASK__GEOMETRY_UTILS_H
16
17#include "object.hpp"
18
23namespace plask {
24
25//TODO at the moment, this template is not used, consider to remove it
29template <int dims>
31
33
34private:
35
37 boost::signals2::connection connection_with_object;
38
40 BoundingBoxT boundingBox;
41
43
44 bool isFresh;
45
46 void connect();
47
48public:
49
55 const BoundingBoxT& operator()();
56
61 void onObjectChanged(const GeometryObject::Event& evt);
62
67 void setObject(GeometryObjectD<dims>* object);
68
74 setObject(&object);
75 }
76
81 void setObject(shared_ptr<GeometryObjectD<dims> > object) {
82 setObject(*object);
83 }
84
90 return object;
91 }
92
97 BoundingBoxCache(GeometryObjectD<dims>* object = 0): object(object), isFresh(false) {
98 connect();
99 }
100
105 BoundingBoxCache(GeometryObjectD<dims>& object): object(&object), isFresh(false) {
106 connect();
107 }
108
113 BoundingBoxCache(shared_ptr< GeometryObjectD<dims> > object): object(object.get()), isFresh(false) {
114 connect();
115 }
116
118 connection_with_object.disconnect();
119 }
120
121};
122
125
126} // namespace plask
127
128#endif // PLASK__GEOMETRY_UTILS_H