| IOLink 1.11.0

Loading...
Searching...
No Matches
ViewOriginExtension.h
1#pragma once
2#include <memory>
3#include <string>
4
5#include <iolink/view/Extension.h>
6
7 namespace iolink
8{
9// forward declaration
10 class View;
11
15 enum class ViewDataOrigin
16{
20 UNKNOWN = 0,
21
25 CPU_MEMORY = 1,
26
30 DRIVE = 2,
31
35 GPU_MEMORY = 3,
36
40 NETWORK = 4,
41
45 GENERATED = 5,
46
50 COMPOSITE = 6
51};
52
61 class IOLINK_API ViewOriginExtension : public Extension
62{
63 public:
67 static constexpr size_t EXTENSION_ID = 0x3;
68
75 inline static std::shared_ptr<ViewOriginExtension> cast(const std::shared_ptr<Extension>& extension)
76 {
77 return std::dynamic_pointer_cast<ViewOriginExtension>(extension);
78 }
79
85 virtual uint64_t uid() const = 0;
86
93 virtual size_t parentCount() const = 0;
94
103 virtual std::shared_ptr<ViewOriginExtension> parent(size_t idx) const = 0;
104
110 virtual ViewDataOrigin dataOrigin() const = 0;
111
117 virtual std::string displayName() const = 0;
118
122 std::string toString() const;
123};
124
125} // end namespace iolink
iolink::Extension
Parent class for all views extensions.
Definition Extension.h:25
iolink::ViewOriginExtension
Extension used to access view's origins if it exists.
Definition ViewOriginExtension.h:62
iolink::ViewOriginExtension::toString
std::string toString() const
String representation of the extension.
iolink::ViewOriginExtension::uid
virtual uint64_t uid() const =0
Returns an unique identifier for current view.
iolink::ViewOriginExtension::dataOrigin
virtual ViewDataOrigin dataOrigin() const =0
Returns the data origin of current view.
iolink::ViewOriginExtension::displayName
virtual std::string displayName() const =0
Returns the name of the current view to display.
iolink::ViewOriginExtension::parent
virtual std::shared_ptr< ViewOriginExtension > parent(size_t idx) const =0
Returns, for the given index, the viewOrigin extension of the parent used to create the current view.
iolink::ViewOriginExtension::parentCount
virtual size_t parentCount() const =0
Returns the count of parents used to create the current view.
iolink::ViewOriginExtension::cast
static std::shared_ptr< ViewOriginExtension > cast(const std::shared_ptr< Extension > &extension)
Upcast a generic extension to this specific type.
Definition ViewOriginExtension.h:75
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8
iolink::PrimitiveTypeId::UNKNOWN
@ UNKNOWN
An opaque type, that the no one knows about.
iolink::ViewDataOrigin
ViewDataOrigin
Enum which represents the different locations where view data may come from.
Definition ViewOriginExtension.h:16
iolink::ViewDataOrigin::NETWORK
@ NETWORK
Data are retrieved through the network.
iolink::ViewDataOrigin::DRIVE
@ DRIVE
Data is located on a drive (HDD, SSD, CD, etc.).
iolink::ViewDataOrigin::GENERATED
@ GENERATED
Data is generated and never stored.
iolink::ViewDataOrigin::GPU_MEMORY
@ GPU_MEMORY
Data is located in GPU memory.
iolink::ViewDataOrigin::CPU_MEMORY
@ CPU_MEMORY
Data is located in CPU memory.
iolink::ViewDataOrigin::COMPOSITE
@ COMPOSITE
Data come from many sources.