Choreonoid
1.8
src
ManipulatorPlugin
MprStatementRegistration.h
Go to the documentation of this file.
1
#ifndef CNOID_MANIPULATOR_PLUGIN_MPR_STATEMENT_REGISTRATION_H
2
#define CNOID_MANIPULATOR_PLUGIN_MPR_STATEMENT_REGISTRATION_H
3
4
#include <string>
5
#include <typeinfo>
6
#include "exportdecl.h"
7
8
namespace
cnoid
{
9
10
class
MprStatement;
11
12
class
CNOID_EXPORT
MprStatementRegistration
13
{
14
public
:
15
typedef
MprStatement
* (*FactoryFunction)();
16
17
MprStatementRegistration
();
18
MprStatementRegistration
(
const
char
* module);
19
20
template
<
class
StatementType,
class
SuperType>
21
MprStatementRegistration
&
registerType
(
const
char
* type){
22
registerFactory_(type,
typeid
(StatementType),
typeid
(SuperType),
23
[]() ->
MprStatement
* {
return
new
StatementType; });
24
return
*
this
;
25
}
26
template
<
class
StatementType,
class
SuperType>
27
MprStatementRegistration
&
registerAbstractType
(){
28
registerFactory_(
""
,
typeid
(StatementType),
typeid
(SuperType),
nullptr
);
29
return
*
this
;
30
}
31
32
static
MprStatement
* create(
const
std::string& type);
33
static
MprStatement
* create(
const
std::string& type,
const
std::string& module);
34
static
const
std::string& fullTypeName(
const
MprStatement
* statement);
35
36
private
:
37
void
registerFactory_(
38
const
char
* typeName,
const
std::type_info& type,
const
std::type_info& superType, FactoryFunction factory);
39
class
Impl;
40
Impl* impl;
41
};
42
43
}
44
45
#endif
46
cnoid::MprStatementRegistration
Definition:
MprStatementRegistration.h:12
cnoid::MprStatementRegistration::registerAbstractType
MprStatementRegistration & registerAbstractType()
Definition:
MprStatementRegistration.h:27
cnoid
Definition:
AbstractSceneLoader.h:11
cnoid::MprStatement
Definition:
MprStatement.h:16
cnoid::MprStatementRegistration::registerType
MprStatementRegistration & registerType(const char *type)
Definition:
MprStatementRegistration.h:21
Generated by
1.8.17