Ocean
Loading...
Searching...
No Matches
SerializationFactory.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_DEVICES_SERIALIZATION_SERIALIZATION_FACTORY_H
9#define META_OCEAN_DEVICES_SERIALIZATION_SERIALIZATION_FACTORY_H
10
12
14
15namespace Ocean
16{
17
18namespace Devices
19{
20
21namespace Serialization
22{
23
24/**
25 * This class implements a device factory for the Serialization library.
26 * @ingroup devicesserialization
27 */
28class OCEAN_DEVICES_SERIALIZATION_EXPORT SerializationFactory : public Factory
29{
31
32 public:
33
34 /**
35 * Registers this factory at the manager.
36 * Beware: Unregister this factory if not needed anymore.
37 * @return True, if this factory hasn't been registered before
38 */
39 static bool registerFactory();
40
41 /**
42 * Unregisters this factory at the manger.
43 * This unregistration should be done after all created devices have been released.
44 * @return True, if this factory chould be unregistered
45 */
46 static bool unregisterFactory();
47
48 protected:
49
50 /**
51 * Creates a new factory.
52 */
54
55 /**
56 * Creates a new 6-DOF Serialization tracker.
57 * The caller is responsible to release the sensor.
58 * @param name The name of the new tracker, must be valid
59 * @param deviceType The device type of the tracker, must be valid
60 * @return The new tracker, nullptr if the tracker could not be created
61 */
62 static Device* createTracker6DOF(const std::string& name, const Device::DeviceType& deviceType);
63
64 /**
65 * Creates a new GPS Serialization tracker.
66 * The caller is responsible to release the sensor.
67 * @param name The name of the new tracker, must be valid
68 * @param deviceType The device type of the tracker, must be valid
69 * @return The new tracker, nullptr if the tracker could not be created
70 */
71 static Device* createGPSTracker(const std::string& name, const Device::DeviceType& deviceType);
72
73 /**
74 * Creates a new 3DOF acceleration Serialization sensor.
75 * The caller is responsible to release the sensor.
76 * @param name The name of the new sensor, must be valid
77 * @param deviceType The device type of the sensor, must be valid
78 * @return The new sensor, nullptr if the sensor could not be created
79 */
80 static Device* createAccelerationSensor3DOF(const std::string& name, const Device::DeviceType& deviceType);
81
82 /**
83 * Creates a new 3DOF gyro Serialization sensor.
84 * The caller is responsible to release the sensor.
85 * @param name The name of the new sensor, must be valid
86 * @param deviceType The device type of the sensor, must be valid
87 * @return The new sensor, nullptr if the sensor could not be created
88 */
89 static Device* createGyroSensor3DOF(const std::string& name, const Device::DeviceType& deviceType);
90
91 /**
92 * Creates a new 3DOF orientation Serialization tracker.
93 * The caller is responsible to release the tracker.
94 * @param name The name of the new tracker, must be valid
95 * @param deviceType The device type of the tracker, must be valid
96 * @return The new tracker, nullptr if the tracker could not be created
97 */
98 static Device* createOrientationTracker3DOF(const std::string& name, const Device::DeviceType& deviceType);
99
100 /**
101 * Creates a new 3DOF gravity Serialization tracker.
102 * The caller is responsible to release the tracker.
103 * @param name The name of the new tracker, must be valid
104 * @param deviceType The device type of the tracker, must be valid
105 * @return The new tracker, nullptr if the tracker could not be created
106 */
107 static Device* createGravityTracker3DOF(const std::string& name, const Device::DeviceType& deviceType);
108
109 /**
110 * Creates a new 3DOF position Serialization tracker.
111 * The caller is responsible to release the tracker.
112 * @param name The name of the new tracker, must be valid
113 * @param deviceType The device type of the tracker, must be valid
114 * @return The new tracker, nullptr if the tracker could not be created
115 */
116 static Device* createPositionTracker3DOF(const std::string& name, const Device::DeviceType& deviceType);
117};
118
119}
120
121}
122
123}
124
125#endif // META_OCEAN_DEVICES_SERIALIZATION_SERIALIZATION_FACTORY_H
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
This class is the base class for all devices of any type.
Definition devices/Device.h:28
This class implements a factory able to create instances of devices.
Definition devices/Factory.h:28
This class implements a device factory for the Serialization library.
Definition SerializationFactory.h:29
static Device * createTracker6DOF(const std::string &name, const Device::DeviceType &deviceType)
Creates a new 6-DOF Serialization tracker.
static bool registerFactory()
Registers this factory at the manager.
static Device * createGravityTracker3DOF(const std::string &name, const Device::DeviceType &deviceType)
Creates a new 3DOF gravity Serialization tracker.
static Device * createOrientationTracker3DOF(const std::string &name, const Device::DeviceType &deviceType)
Creates a new 3DOF orientation Serialization tracker.
static Device * createPositionTracker3DOF(const std::string &name, const Device::DeviceType &deviceType)
Creates a new 3DOF position Serialization tracker.
static Device * createGPSTracker(const std::string &name, const Device::DeviceType &deviceType)
Creates a new GPS Serialization tracker.
static Device * createAccelerationSensor3DOF(const std::string &name, const Device::DeviceType &deviceType)
Creates a new 3DOF acceleration Serialization sensor.
static Device * createGyroSensor3DOF(const std::string &name, const Device::DeviceType &deviceType)
Creates a new 3DOF gyro Serialization sensor.
static bool unregisterFactory()
Unregisters this factory at the manger.
This class implements a player for device objects based on Ocean's DataSerializer.
Definition SerializerDevicePlayer.h:45
The namespace covering the entire Ocean framework.
Definition Accessor.h:15