ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/shapes/Union.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU 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 * ESPResSo 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 General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef SCRIPT_INTERFACE_SHAPES_SHAPE_UNION_HPP
23#define SCRIPT_INTERFACE_SHAPES_SHAPE_UNION_HPP
24
25#include "Shape.hpp"
27
28#include <shapes/Union.hpp>
29
30#include <memory>
31#include <string>
32#include <vector>
33
34namespace ScriptInterface {
35namespace Shapes {
36
37class Union : public ObjectList<Shape, Shape> {
38public:
39 Union() : m_core_shape(std::make_shared<::Shapes::Union>()) {}
40
41private:
42 bool has_in_core(const std::shared_ptr<Shape> &obj_ptr) const override {
43 return m_core_shape->contains(obj_ptr->shape());
44 }
45 void add_in_core(const std::shared_ptr<Shape> &obj_ptr) override {
46 m_core_shape->add(obj_ptr->shape());
47 }
48 void remove_in_core(const std::shared_ptr<Shape> &obj_ptr) override {
49 m_core_shape->remove(obj_ptr->shape());
50 }
51
52public:
53 std::shared_ptr<::Shapes::Shape> shape() const override {
54 return m_core_shape;
55 }
56
57private:
58 std::shared_ptr<::Shapes::Union> m_core_shape;
59 std::vector<std::shared_ptr<Shapes::Shape>> m_shapes;
60};
61
62} /* namespace Shapes */
63} /* namespace ScriptInterface */
64
65#endif
Owning list of ObjectHandles.
void remove_in_core(const std::shared_ptr< Shape > &obj_ptr) override
bool has_in_core(const std::shared_ptr< Shape > &obj_ptr) const override
std::shared_ptr<::Shapes::Shape > shape() const override
void add_in_core(const std::shared_ptr< Shape > &obj_ptr) override
T get_value(Variant const &v)
Extract value of specific type T from a Variant.