iFun Engine API  1.0.0-b6053
Great Technology for Great Games
component.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_FRAMEWORK_COMPONENT_H_
10 #define INCLUDE_FUNAPI_FRAMEWORK_COMPONENT_H_
11 
12 #include <boost/noncopyable.hpp>
14 #include <funapi/types.h>
15 
16 
17 namespace fun {
18 
20 class FUNAPI_DLL_VISIBILITY Component : public boost::noncopyable {
21  public:
22  static const ArgumentMap *FindArgument(const string &component_name);
23 
24  private:
25  Component() {}
26 };
27 
28 } // namespace fun
29 
30 
32 #define REGISTER_COMPONENT(COMPONENT_NAME, INSTALLER_CLS) \
33 \
34 extern "C" FUNAPI_DLL_VISIBLE bool COMPONENT_NAME ## _install( \
35  const fun::ArgumentMap &arguments) { \
36  return INSTALLER_CLS::Install(arguments); \
37 } \
38 \
39 extern "C" FUNAPI_DLL_VISIBLE bool COMPONENT_NAME ## _uninstall() { \
40  return INSTALLER_CLS::Uninstall(); \
41 } \
42 
43 
45 #define REGISTER_STARTABLE_COMPONENT(COMPONENT_NAME, INSTALLER_CLS) \
46  REGISTER_COMPONENT(COMPONENT_NAME, INSTALLER_CLS) \
47  \
48  extern "C" FUNAPI_DLL_VISIBLE bool COMPONENT_NAME ## _start() { \
49  return INSTALLER_CLS::Start(); \
50  } \
51 
52 
53 #define REGISTER_STARTABLE_COMPONENT2(COMPONENT_NAME, INSTALLER_CLS) \
54  REGISTER_STARTABLE_COMPONENT(COMPONENT_NAME, INSTALLER_CLS) \
55  \
56  extern "C" FUNAPI_DLL_VISIBLE bool COMPONENT_NAME ## _stop() { \
57  return INSTALLER_CLS::Stop(); \
58  } \
59 
60 
61 #endif // INCLUDE_FUNAPI_FRAMEWORK_COMPONENT_H_
ArgumentMap class manages application-specific run-time arguments.
Definition: argument_map.h:23
Base class for any service in Funapi.
Definition: component.h:20
Definition: json.h:18