Mantid
Loading...
Searching...
No Matches
ICompAssembly.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidGeometry/DllConfig.h"
11#include <deque>
12#include <string>
13#include <vector>
14
15namespace Mantid {
16namespace Geometry {
17// Forward declaration
18class Track;
19
30class MANTID_GEOMETRY_DLL ICompAssembly : public virtual IComponent {
31public:
32 // Default constructor;
33 // Fixes warning C4436 on Windows.
36 std::string type() const override { return "ICompAssembly"; }
38 IComponent *clone() const override = 0;
40 virtual int nelements() const = 0;
42 virtual int add(IComponent *) = 0;
44 virtual int addCopy(IComponent *) = 0;
46 virtual int addCopy(IComponent *, const std::string &) = 0;
49 virtual std::shared_ptr<IComponent> getChild(const int i) const = 0;
52 virtual std::shared_ptr<const IComponent> getComponentByName(const std::string &cname, int nlevels = 0) const = 0;
54 virtual void getChildren(std::vector<IComponent_const_sptr> &outVector, bool recursive) const = 0;
57 virtual std::shared_ptr<IComponent> operator[](int i) const = 0;
59 virtual void printChildren(std::ostream &) const = 0;
64 virtual void printTree(std::ostream &) const = 0;
65
68 virtual void testIntersectionWithChildren(Track &testRay, std::deque<IComponent_const_sptr> &searchQueue) const = 0;
69
70protected:
72 ICompAssembly(const ICompAssembly &) = default;
73
74private:
76};
77
79using ICompAssembly_sptr = std::shared_ptr<ICompAssembly>;
81using ICompAssembly_const_sptr = std::shared_ptr<const ICompAssembly>;
82
83} // Namespace Geometry
84} // Namespace Mantid
Class for Assembly of geometric components.
Definition: ICompAssembly.h:30
virtual void printTree(std::ostream &) const =0
Print information about all the elements in the tree to a stream Loops through all components in the ...
IComponent * clone() const override=0
Make a clone of the present component.
ICompAssembly & operator=(const ICompAssembly &)=delete
virtual void getChildren(std::vector< IComponent_const_sptr > &outVector, bool recursive) const =0
Get all children.
ICompAssembly(const ICompAssembly &)=default
Protected copy constructor.
virtual std::shared_ptr< const IComponent > getComponentByName(const std::string &cname, int nlevels=0) const =0
Returns a pointer to the first component of assembly encountered with the given name.
virtual int addCopy(IComponent *)=0
Add a copy (clone) of a component.
virtual std::shared_ptr< IComponent > getChild(const int i) const =0
Get a pointer to the ith component within the assembly.
std::string type() const override
String description of the type of component.
Definition: ICompAssembly.h:36
virtual void printChildren(std::ostream &) const =0
Print information about all children.
virtual void testIntersectionWithChildren(Track &testRay, std::deque< IComponent_const_sptr > &searchQueue) const =0
Test the intersection of the ray with the children of the component assembly.
virtual int nelements() const =0
Return the number of elements in the assembly.
virtual int addCopy(IComponent *, const std::string &)=0
Add a copy (clone) of a component and rename it.
virtual std::shared_ptr< IComponent > operator[](int i) const =0
Overloaded index operator.
virtual int add(IComponent *)=0
Add a component to the assembly.
base class for Geometric IComponent
Definition: IComponent.h:51
Defines a track as a start point and a direction.
Definition: Track.h:165
std::shared_ptr< const ICompAssembly > ICompAssembly_const_sptr
Shared pointer to a const ICompAssembly.
Definition: ICompAssembly.h:81
std::shared_ptr< ICompAssembly > ICompAssembly_sptr
Shared pointer to a ICompAssembly.
Definition: ICompAssembly.h:79
Helper class which provides the Collimation Length for SANS instruments.