Caffa  1.1.0
C++ Application Framework for Embedded Systems with introspection
cafChildFieldHandle.h
1 // ##################################################################################################
2 //
3 // Caffa
4 // Copyright (C) 2023- Kontur AS
5 //
6 // GNU Lesser General Public License Usage
7 // This library is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation; either version 2.1 of the License, or
10 // (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
17 // for more details.
18 //
19 // ##################################################################################################
20 #pragma once
21 
22 #include "cafFieldHandle.h"
23 #include "cafObjectHandle.h"
24 #include "cafVisitor.h"
25 
26 namespace caffa
27 {
28 class ChildFieldAccessor;
29 class ObjectHandle;
30 
31 template <typename DataTypePtr>
32 concept is_pointer = std::is_pointer<DataTypePtr>::value;
33 
35 {
36 public:
41  virtual std::string childClassKeyword() const = 0;
42 
43  virtual std::vector<ObjectHandle::Ptr> childObjects() = 0;
44  virtual std::vector<ObjectHandle::ConstPtr> childObjects() const = 0;
45  void accept( Inspector* visitor ) const override { visitor->visitChildField( this ); }
46  void accept( Editor* visitor ) override { visitor->visitChildField( this ); }
47 };
48 
50 {
51 public:
52  virtual void setAccessor( std::unique_ptr<ChildFieldAccessor> accessor ) = 0;
53  virtual void clear() = 0;
54 };
55 } // namespace caffa
Definition: cafChildFieldHandle.h:35
virtual std::string childClassKeyword() const =0
Get the class keyword of the contained child(ren)
void accept(Inspector *visitor) const override
Definition: cafChildFieldHandle.h:45
void accept(Editor *visitor) override
Definition: cafChildFieldHandle.h:46
Definition: cafChildFieldHandle.h:50
Definition: cafVisitor.h:43
Base class for all fields, making it possible to handle them generically.
Definition: cafFieldHandle.h:23
Definition: cafVisitor.h:32
Main Caffa namespace.
Definition: __init__.py:1