Ocean
TimeSensor.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_SCENEDESCRIPTION_SDX_X3D_TIME_SENSOR_NODE_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TIME_SENSOR_NODE_H
10 
14 
15 namespace Ocean
16 {
17 
18 namespace SceneDescription
19 {
20 
21 namespace SDX
22 {
23 
24 namespace X3D
25 {
26 
27 /**
28  * This class implements a time sensor node.
29  * @ingroup scenedescriptionsdxx3d
30  */
31 class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT TimeSensor :
32  virtual public X3DTimeDependentNode,
33  virtual public X3DSensorNode
34 {
35  public:
36 
37  /**
38  * Creates an abstract time sensor node.
39  * @param environment Node environment
40  */
41  explicit TimeSensor(const SDXEnvironment* environment);
42 
43  protected:
44 
45  /**
46  * Specifies the node type and the fields of this node.
47  * @return Unique node specification of this node
48  */
50 
51  /**
52  * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
53  * @see SDXNode::onInitialize().
54  */
55  void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
56 
57  /**
58  * Explicit changing event function for node fields.
59  * @see X3DNode::onFieldChanging().
60  */
61  bool onFieldChanging(const std::string& fieldName, const Field& field) override;
62 
63  /**
64  * Event function to inform the node about a changed field.
65  * @see SDXNode::onFieldChanged().
66  */
67  void onFieldChanged(const std::string& fieldName) override;
68 
69  /**
70  * Event function for node update events.
71  * @see X3DTimeDependentNode::onUpdated().
72  */
73  void onUpdated(const Timestamp timestamp) override;
74 
75  /**
76  * Event function for node start events.
77  * @see X3DTimeDependentNode::onStarted().
78  */
79  void onStarted(const Timestamp eventTimestamp) override;
80 
81  /**
82  * Event function for node pause events.
83  * @see X3DTimeDependentNode::onPaused().
84  */
85  void onPaused(const Timestamp eventTimestamp) override;
86 
87  /**
88  * Event function for node resume events.
89  * @see X3DTimeDependentNode::onResumed().
90  */
91  void onResumed(const Timestamp eventTimestamp) override;
92 
93  /**
94  * Event function for node stop events.
95  * @see X3DTimeDependentNode::onStopped().
96  */
97  void onStopped(const Timestamp eventTimestamp) override;
98 
99  /**
100  * Returns the address of the most derived object.
101  * @see Node::objectAddress().
102  */
103  size_t objectAddress() const override;
104 
105  protected:
106 
107  /// CycleInterval field.
109 
110  /// CycleTime field.
112 
113  /// Fraction_changed field.
115 
116  /// Time field.
118 
119  /// Last fraction value.
121 };
122 
123 }
124 
125 }
126 
127 }
128 
129 }
130 
131 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TIME_SENSOR_NODE_H
This class is the base class for all scene description fields.
Definition: Field.h:36
This class implements a node specification object.
Definition: scenedescription/Node.h:77
This class implements a time sensor node.
Definition: TimeSensor.h:34
void onStarted(const Timestamp eventTimestamp) override
Event function for node start events.
void onUpdated(const Timestamp timestamp) override
Event function for node update events.
SingleFloat fractionChanged_
Fraction_changed field.
Definition: TimeSensor.h:114
SingleTime cycleTime_
CycleTime field.
Definition: TimeSensor.h:111
Scalar lastFraction_
Last fraction value.
Definition: TimeSensor.h:120
SingleTime time_
Time field.
Definition: TimeSensor.h:117
bool onFieldChanging(const std::string &fieldName, const Field &field) override
Explicit changing event function for node fields.
SingleTime cycleInterval_
CycleInterval field.
Definition: TimeSensor.h:108
size_t objectAddress() const override
Returns the address of the most derived object.
void onStopped(const Timestamp eventTimestamp) override
Event function for node stop events.
void onResumed(const Timestamp eventTimestamp) override
Event function for node resume events.
void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp) override
Event function to inform the node that it has been initialized and can apply all internal values to c...
void onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
NodeSpecification specifyNode()
Specifies the node type and the fields of this node.
TimeSensor(const SDXEnvironment *environment)
Creates an abstract time sensor node.
void onPaused(const Timestamp eventTimestamp) override
Event function for node pause events.
This class implements an abstract x3d sensor node.
Definition: X3DSensorNode.h:31
This class implements an abstract x3d time dependent node.
Definition: X3DTimeDependentNode.h:35
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements a timestamp.
Definition: Timestamp.h:36
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15