~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to inc/srCore/pluginEntryPointBase.h

  • Committer: Anne van Rossum
  • Date: 2010-08-10 15:58:55 UTC
  • Revision ID: anne@gamix-20100810155855-kve7x2vwouagdij9
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file pluginEntryPointBase.cpp
 
3
 *
 
4
 * This file pluginEntryPointBase.cpp is created at Almende B.V. It is open-source software and part
 
5
 * of the Common Hybrid Agent Platform (CHAP). A toolbox with a lot of open-source tools.
 
6
 * Ranging from thread pools, and TCP/IP components to control architectures and learning
 
7
 * algorithms. This software is published under the GNU Lesser General Public license,
 
8
 *
 
9
 * It is not possible to add usage restrictions to an open-source license. Nevertheless,
 
10
 * we personally strongly object against this software used by the military, in the
 
11
 * bio-industry, for animal experimentation, or anything that violates the Universal
 
12
 * Declaration of Human Rights.
 
13
 *
 
14
 * @author  Anne C. van Rossum
 
15
 * @date    Dec 2, 2009
 
16
 * @project Replicator FP7
 
17
 * @company Almende B.V.
 
18
 * @case
 
19
 */
 
20
 
 
21
#ifndef PLUGINENTRYPOINTBASE_H_
 
22
#define PLUGINENTRYPOINTBASE_H_
 
23
 
 
24
// Delta3D files
 
25
#include <dtGame/gameapplication.h>
 
26
#include <dtGame/gmcomponent.h>
 
27
 
 
28
// Robot3D files
 
29
#include <srCore/export.h>
 
30
 
 
31
namespace srCore {
 
32
 
 
33
/**
 
34
 * This class functions exactly the same as the Delta3D class dtGame::GameEntryPoint. It is meant
 
35
 * to be inherited by classes that want to add additional functionality to the simulator, for
 
36
 * example in the form of components. Examples of such components:
 
37
 * <ul>
 
38
 * <li>A component that adds coloured traces to the trajectories of the robots.
 
39
 * <li>A component that adds colours to the robots.
 
40
 * <li>A component that adds an UART interface to each robot in the simulator.
 
41
 * </ul>
 
42
 * For example, inherit PluginEntryPointBase by TraceComponent.
 
43
 *
 
44
 * The two functions that are needed (you define them in TraceComponent.cpp):
 
45
 * <ul>
 
46
 * <li>extern "C" ROBOT_EXPORT PluginEntryPoint* CreatePluginEntryPoint();
 
47
 * <li>extern "C" ROBOT_EXPORT void DestroyPluginEntryPoint();
 
48
 * </ul>
 
49
 * They need to have the code to create a TraceComponent and destroy it again. Of course, it is
 
50
 * possible to have a Singleton of the derived TraceComponent class. However, PluginEntryPointBase
 
51
 * is not a singleton, it can be inherited in multiple libraries.
 
52
 */
 
53
class ROBOT_EXPORT PluginEntryPointBase {
 
54
public:
 
55
        /**
 
56
         * Constructor
 
57
         */
 
58
        PluginEntryPointBase() {;}
 
59
 
 
60
        /**
 
61
         * Destructor
 
62
         */
 
63
        virtual ~PluginEntryPointBase() {;}
 
64
 
 
65
        /**
 
66
         * A virtual function that makes this class abstract (like a Java interface). This function
 
67
         * needs to be implemented by your derived class. It will be the function that is called
 
68
         * by Robot3D right after CreatePluginEntryPoint. It will have a reference to the Delta3D
 
69
         * dtGame::GameApplication class, so it is possible to get hands on all possible components
 
70
         * and controllers via that class.
 
71
         *
 
72
         * As example, take a look how the srInterface library is organised.
 
73
         *
 
74
         * @param application A Delta3D GameApplication class through which everything can be obtained
 
75
         */
 
76
        virtual void StartPlugin(dtGame::GameApplication &application) = 0;
 
77
};
 
78
 
 
79
 
 
80
}
 
81
 
 
82
#endif /* PLUGINENTRYPOINTBASE_H_ */