Caffa  1.1.0
C++ Application Framework for Embedded Systems with introspection
cafObjectFactory.h
1 // ##################################################################################################
2 //
3 // Caffa
4 // Copyright (C) 2011- Ceetron AS (Changes up until April 2021)
5 // Copyright (C) 2021- Kontur AS (Changes from April 2021 and onwards)
6 //
7 // GNU Lesser General Public License Usage
8 // This library is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU Lesser General Public License as published by
10 // the Free Software Foundation; either version 2.1 of the License, or
11 // (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful, but WITHOUT ANY
14 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE.
16 //
17 // See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
18 // for more details.
19 //
20 // ##################################################################################################
21 
22 #pragma once
23 
24 #include "cafObjectHandle.h"
25 
26 #include <list>
27 #include <memory>
28 #include <string>
29 #include <vector>
30 
31 namespace caffa
32 {
33 //==================================================================================================
34 //
35 // Factory interface for creating CAF objects derived from ObjectHandle based on class name keyword
36 //
37 //==================================================================================================
39 {
40 public:
41  ObjectHandle::Ptr create( const std::string_view& classKeyword ) { return doCreate( classKeyword ); }
42 
43  virtual std::string name() const = 0;
44 
45 protected:
46  ObjectFactory() {}
47  virtual ~ObjectFactory() {}
48 
49 private:
50  virtual ObjectHandle::Ptr doCreate( const std::string_view& classKeyword ) = 0;
51 };
52 
53 } // End of namespace caffa
Definition: cafObjectFactory.h:39
Main Caffa namespace.
Definition: __init__.py:1