Ocean
EPYLibrary.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_INTERACTION_EPY_LIBRARY_H
9 #define META_OCEAN_INTERACTION_EPY_LIBRARY_H
10 
12 
14 
15 #include <vector>
16 
17 namespace Ocean
18 {
19 
20 namespace Interaction
21 {
22 
23 namespace Empty
24 {
25 
26 /**
27  * This class implements the empty demo interaction library object.
28  * @ingroup interactionepy
29  */
30 class OCEAN_INTERACTION_EPY_EXPORT EPYLibrary : public Library
31 {
32  public:
33 
34  /**
35  * Creates this library and registeres it at the global interaction manager.<br>
36  * Do not register this library if using it as plugin, because it's done by the plugin itself.<br>
37  * However, if you are not using the plugin mechanism you have to initialize this library once at program initialization.<br>
38  * If the library is not used anymore unregister it using the unregister function.<br>
39  * Beware: This registration must not be done more than once!<br>
40  * @see Manager, unregisterLibrary()
41  */
42  static void registerLibrary();
43 
44  /**
45  * Unregisters this library at the global interaction manager.
46  * Do not unregister this library if using it as plugin, because it's done by the plugin itself when the plugin is unloaded.<br>
47  * Beware: This registration must not be done more than once and must not be done without previous registration!<br>
48  * @return True, if succeeded
49  * @see Manager, registerLibrary()
50  */
51  static bool unregisterLibrary();
52 
53  /**
54  * Loads a new interaction file.
55  * @see Library::load().
56  */
57  bool load(const UserInterface& userInterface, const Rendering::EngineRef& engine, const Timestamp timestamp, const std::string& filename) override;
58 
59  /**
60  * Unloads one specific loaded interaction files.
61  * @see Library::unload().
62  */
63  bool unload(const UserInterface& userInterface, const Rendering::EngineRef& engine, const Timestamp timestamp, const std::string& filename) override;
64 
65  /**
66  * Unloads all loaded interaction files.
67  * @see Library::unload
68  */
69  void unload(const UserInterface& userInterface, const Rendering::EngineRef& engine, const Timestamp timestamp) override;
70 
71  /**
72  * Pre file load interaction function.
73  * @see Library::preFileLoad().
74  */
75  void preFileLoad(const UserInterface& userInterface, const std::string& filename) override;
76 
77  /**
78  * Post file load interaction function.
79  * @see Library::postFileLoad().
80  */
81  void postFileLoad(const UserInterface& userInterface, const std::string& filename, const bool succeeded) override;
82 
83  /**
84  * Pre update interaction function.
85  * @see Library::preUpdate().
86  */
87  Timestamp preUpdate(const UserInterface& userInterface, const Rendering::EngineRef& engine, const Timestamp timestamp) override;
88 
89  /**
90  * Post update interaction function.
91  * @see Library::postUpdate().
92  */
93  void postUpdate(const UserInterface& userInterface, const Rendering::EngineRef& engine, const Timestamp timestamp) override;
94 
95  /**
96  * Key press function.
97  * @see Library::onKeyPress().
98  */
99  void onKeyPress(const UserInterface& userInterface, const Rendering::EngineRef& engine, const std::string& key, const Timestamp timestamp) override;
100 
101  /**
102  * Key press function.
103  * @see Library::onKeyRelease().
104  */
105  void onKeyRelease(const UserInterface& userInterface, const Rendering::EngineRef& engine, const std::string& key, const Timestamp timestamp) override;
106 
107  protected:
108 
109  /**
110  * Creates a new Empty Demo Interaction Library object.
111  */
113 
114  /**
115  * Destructs an Empty Demo Interaction Library object.
116  */
117  ~EPYLibrary() override;
118 
119  protected:
120 
121  /// Interaction library lock.
123 };
124 
125 }
126 
127 }
128 
129 }
130 
131 #endif // META_OCEAN_INTERACTION_EPY_LIBRARY_H
This class implements the empty demo interaction library object.
Definition: EPYLibrary.h:31
Timestamp preUpdate(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp) override
Pre update interaction function.
static void registerLibrary()
Creates this library and registeres it at the global interaction manager.
static bool unregisterLibrary()
Unregisters this library at the global interaction manager.
void onKeyPress(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp) override
Key press function.
void onKeyRelease(const UserInterface &userInterface, const Rendering::EngineRef &engine, const std::string &key, const Timestamp timestamp) override
Key press function.
bool load(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename) override
Loads a new interaction file.
Lock lock_
Interaction library lock.
Definition: EPYLibrary.h:122
void postFileLoad(const UserInterface &userInterface, const std::string &filename, const bool succeeded) override
Post file load interaction function.
EPYLibrary()
Creates a new Empty Demo Interaction Library object.
void preFileLoad(const UserInterface &userInterface, const std::string &filename) override
Pre file load interaction function.
void postUpdate(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp) override
Post update interaction function.
void unload(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp) override
Unloads all loaded interaction files.
~EPYLibrary() override
Destructs an Empty Demo Interaction Library object.
bool unload(const UserInterface &userInterface, const Rendering::EngineRef &engine, const Timestamp timestamp, const std::string &filename) override
Unloads one specific loaded interaction files.
This class implements the base class for all interaction libraries.
Definition: interaction/Library.h:29
This class holds UI elements of the application from which the interaction is executed.
Definition: UserInterface.h:28
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15