Open FFBoard
Open source force feedback firmware
ChoosableClass.h
Go to the documentation of this file.
1/*
2 * ChoosableClass.h
3 *
4 * Created on: 18.02.2020
5 * Author: Yannick
6 */
7
8#ifndef CHOOSABLECLASS_H_
9#define CHOOSABLECLASS_H_
10#include "ClassIDs.h"
11#include "string"
12
13enum class ClassVisibility : uint8_t {visible,debug,hidden};
14
16 const char* name = nullptr; // Display name of this class
17 uint16_t id; // The id equivalent to clsname. Classes with the same clsname must have the same id in this field. Classchooser can use this or a separate id for selection
19};
20
21template<class T>
22class ClassChooser;
23
25 template<class T>
26 friend class ClassChooser;
27
28public:
29 //ChoosableClass(){};
30 virtual ~ChoosableClass(){};
31
33
34
40 static bool isCreatable() {return true;};
41 virtual const ClassIdentifier getInfo() = 0;
42
43 uint16_t getSelectionID(){return selectionId;};
44
49 virtual const ClassType getClassType(){return ClassType::NONE;};
50
51protected:
52 uint16_t selectionId;
53};
54
55#endif /* CHOOSABLECLASS_H_ */
ClassVisibility
ClassType
Definition: ClassIDs.h:12
static bool isCreatable()
static ClassIdentifier info
uint16_t selectionId
Should only be written by ClassChooser during creation.
virtual ~ChoosableClass()
uint16_t getSelectionID()
virtual const ClassIdentifier getInfo()=0
virtual const ClassType getClassType()
returns the used classchooser selection id of this instance
const char * name
ClassVisibility visibility