Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
inc
WireCellUtil
IComponent.h
Go to the documentation of this file.
1
#ifndef WIRECELL_ICOMPONENT
2
#define WIRECELL_ICOMPONENT
3
4
#include "
WireCellUtil/Interface.h
"
5
6
#include <vector>
7
8
namespace
WireCell
{
9
10
/** A component calls out a particular interface as being
11
* identified as important to the system. Inheriting from
12
* IComponent follows the CRTP pattern:
13
*
14
* class IMyComponent : public IComponent<IMyComponent> {
15
* public: void mymethod() = 0;
16
* };
17
*
18
* class MyConcreteComponent : public IMyComponent {
19
* public: void mymethod();
20
* };
21
*
22
* IMyComponent::pointer mycomp(new MyConcreteComponent);
23
* mycomp->mymethod();
24
*
25
* See WireCell::NamedFactory for one creation pattern that works
26
* with IComponents.
27
*/
28
template
<
class
Type>
// crtp
29
class
IComponent
:
virtual
public
Interface
{
30
public
:
31
32
/// Access subclass facet by pointer.
33
typedef
std::shared_ptr<Type>
pointer
;
34
35
/// Vector of shared pointers.
36
typedef
std::vector<pointer>
vector
;
37
38
virtual
~IComponent
() {};
39
};
40
41
42
}
43
44
#endif
45
WireCell::IComponent::pointer
std::shared_ptr< Type > pointer
Access subclass facet by pointer.
Definition:
IComponent.h:33
WireCell::Interface
Definition:
Interface.h:13
WireCell::IComponent
Definition:
IComponent.h:29
WireCell::IComponent::vector
std::vector< pointer > vector
Vector of shared pointers.
Definition:
IComponent.h:36
WireCell
Definition:
Main.h:22
Interface.h
WireCell::IComponent::~IComponent
virtual ~IComponent()
Definition:
IComponent.h:38
Generated by
1.8.11