opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
libopynsim
documents
state_view_with_metadata.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
liboscar/utilities/uid.h
>
4
5
#include <optional>
6
7
namespace
SimTK
{
class
State; }
8
9
namespace
opyn
10
{
11
// An abstract base class that represents the pairing of a readonly `SimTK::State` with metadata.
12
class
StateViewWithMetadata
{
13
protected
:
14
StateViewWithMetadata
() =
default
;
15
StateViewWithMetadata
(
const
StateViewWithMetadata
&) =
default
;
16
StateViewWithMetadata
(
StateViewWithMetadata
&&) noexcept = default;
17
~
StateViewWithMetadata
() noexcept = default;
18
19
StateViewWithMetadata
& operator=(const
StateViewWithMetadata
&) = default;
20
StateViewWithMetadata
& operator=(
StateViewWithMetadata
&&) noexcept = default;
21
friend
bool
operator==(const
StateViewWithMetadata
&, const
StateViewWithMetadata
&) = default;
22
23
public:
24
// Returns a reference to the readonly `SimTK::State` this view is viewing.
25
const
SimTK
::State&
getState
()
const
{
return
implGetState
(); }
26
27
// Returns a single auxiliary value (metadata) associated with the state that this
28
// view is viewing.
29
std::optional<float>
getAuxiliaryValue
(
osc::UID
id
)
const
{
return
implGetAuxiliaryValue
(
id
); }
30
31
private
:
32
// Implementors must provide a const accessor to a state
33
virtual
const
SimTK::State&
implGetState
()
const
= 0;
34
35
// Implementors may provide a way of accessing auxiliary (metadata)
36
// associated with the state.
37
virtual
std::optional<float>
implGetAuxiliaryValue
(
osc::UID
)
const
{
return
std::nullopt; }
38
};
39
}
opyn::StateViewWithMetadata
Definition
state_view_with_metadata.h:12
opyn::StateViewWithMetadata::StateViewWithMetadata
StateViewWithMetadata()=default
opyn::StateViewWithMetadata::StateViewWithMetadata
StateViewWithMetadata(StateViewWithMetadata &&) noexcept=default
opyn::StateViewWithMetadata::StateViewWithMetadata
StateViewWithMetadata(const StateViewWithMetadata &)=default
opyn::StateViewWithMetadata::implGetAuxiliaryValue
virtual std::optional< float > implGetAuxiliaryValue(osc::UID) const
Definition
state_view_with_metadata.h:37
opyn::StateViewWithMetadata::getAuxiliaryValue
std::optional< float > getAuxiliaryValue(osc::UID id) const
Definition
state_view_with_metadata.h:29
opyn::StateViewWithMetadata::getState
const SimTK::State & getState() const
Definition
state_view_with_metadata.h:25
opyn::StateViewWithMetadata::implGetState
virtual const SimTK::State & implGetState() const =0
osc::UID
Definition
uid.h:14
SimTK
Definition
custom_decoration_generator.h:6
opyn
Definition
component_registry.h:14
uid.h
Generated by
1.9.8