![]() |
SCENE C++ API
2.0.31
|
Interface to create and read generic binary objects. More...
#include <lsgenericbinaryobject.h>
Public Member Functions | |
ref_ptr< LSBinaryReader > | getData () |
Returns an binary data iterator that can be used to read the binary data. More... | |
size_t | getSize () const |
Returns the exact overall size of the data. More... | |
LSString | getMimeType () const |
Returns the MIME type string of the Generic Binary Object. More... | |
LSString | getContext () const |
Returns the context string of the Generic Binary Object. More... | |
LSString | getId () const |
Returns the ID string of the Generic Binary Object. More... | |
![]() | |
Eigen::Matrix4d | getTransformationToGlobal () const |
Calculates the transformation matrix which transforms local object coordinates to global coordinates. More... | |
void | select () |
Selects this object. More... | |
LSIterator< ref_ptr< LSObject > > | getChildIterator () const |
Gets an iterator which can be used for a breadth-first iteration over all objects below the object in the object hierarchy. More... | |
ref_ptr< LSObject > | getParent () const |
Returns the parent of this object. More... | |
unsigned int | getNumChildren () const |
Returns the number of children of this object. More... | |
ref_ptr< LSObject > | getChild (unsigned int n) const |
Returns the n-th child of this object. More... | |
ref_ptr< LSObject > | getChild (LSString name) const |
Returns the child of this object with a given name. More... | |
bool | rmChild (unsigned int n) |
Removes a child from this object. More... | |
bool | rmChild (LSString name) |
Removes a child from this object. More... | |
LSResult::Result | addChild (LSString name, LSString typeName, ref_ptr< LSObject > &childOut) |
Creates a new child of the given type. More... | |
LSResult::Result | generateUniqueChildName (const LSString &baseName, LSString &nameOut) const |
Generates a valid and unique name for a new child of this object based on the provided base name. More... | |
LSResult::Result | setParent (ref_ptr< LSObject > newParent) |
Changes the parent of this object. More... | |
![]() | |
LSString | getTypeName () const |
Gets the type name of this instance. More... | |
LSString | getName () const |
Gets the name of the container. More... | |
LSResult::Result | setName (LSString name) |
Sets the name of the container. More... | |
LSString | getUuid () const |
Returns the unique id of the container. More... | |
LSString | assignUuid () |
Assigns a unique id to the container if the container does not not yet have a unique id. More... | |
unsigned int | getNumAttributes () const |
Get the number of attributes in the container. More... | |
LSString | getAttributeName (unsigned int index) const |
Get the name of an attribute in the container. More... | |
unsigned int | getAttributeIndex (LSString name) const |
Get the index of an attribute in the container. More... | |
LSAttribute | getAttribute (unsigned int index) const |
Get an attribute based on its index. More... | |
LSAttribute | getAttribute (LSString name) const |
Get an attribute based on its name. More... | |
LSResult::Result | setAttribute (unsigned int index, const LSAttribute &attribute) |
Set an attribute based on its index. More... | |
LSResult::Result | setAttribute (LSString name, const LSAttribute &attribute) |
Set an attribute based on its name. More... | |
LSResult::Result | addCustomAttribute (LSString name, const LSAttribute &attribute) |
Add a new custom attribute to the container. More... | |
bool | removeCustomAttribute (LSString name) |
Remove a custom attribute from the container. More... | |
unsigned int | getNumFields () const |
Returns the number of fields in the container. More... | |
ref_ptr< LSAttributeContainer > | getField (unsigned int index) const |
Returns the field at position n in the container. More... | |
ref_ptr< LSAttributeContainer > | getField (const LSString &name) const |
Returns the field with the given name. More... | |
LSResult::Result | addField (const LSString &name, const LSString &typeName, ref_ptr< LSAttributeContainer > &fieldOut) |
Add a field to the container. More... | |
bool | rmField (const LSString &name) |
Removes the field with a given name from the container. More... | |
Static Public Member Functions | |
static LSResult::Result | createGenericBinaryObject (const ref_ptr< LSObject > &parent, const LSString &name, const LSString &context, const LSString &id, const LSString &filePath, ref_ptr< LSGenericBinaryObject > &gbo, const LSString &mimeType=LSString()) |
Create a Generic Binary Object from a given file. More... | |
static LSResult::Result | createGenericBinaryObject (const ref_ptr< LSObject > &parent, const LSString &name, const LSString &context, const LSString &id, const LSString &mimeType, const ref_ptr< LSBinaryReader > &source, ref_ptr< LSGenericBinaryObject > &gbo) |
Create a GenericBinaryObject from a custom data source. More... | |
Additional Inherited Members | |
![]() | |
void | ref () const |
Increments the internal reference counter. More... | |
void | unref () const |
Decrements the internal reference counter. More... | |
Interface to create and read generic binary objects.
Generic binary objects (GBOs) can store user-defined data inside a SCENE project. GBOs are not visible in the SCENE structure tree, but behave otherwise like other SCENE objects. An good example use case would be to store additional binary data that can be only understood by your plugin app or standalone app inside a SCENE project to make it self-contained. Please remember that older API versions might not fully support SCENE projects with GBOs. GBOs can be created below many different parent objects. Useful examples are the root object, clusters or scans.
ref_ptr<LSBinaryReader> getData | ( | ) |
Returns an binary data iterator that can be used to read the binary data.
The returned iterator object will have an exclusive read lock on the GBO while its alive! Make sure to free the binary data iterator as soon as possible.
size_t getSize | ( | ) | const |
Returns the exact overall size of the data.
May be slow for large objects since it requires to stream through the data once.
LSString getMimeType | ( | ) | const |
Returns the MIME type string of the Generic Binary Object.
See also: https://www.iana.org/assignments/media-types/media-types.xhtml
LSString getContext | ( | ) | const |
Returns the context string of the Generic Binary Object.
The context string is user-defined and used to group the same type of objects.
LSString getId | ( | ) | const |
Returns the ID string of the Generic Binary Object.
The ID string is user-defined and used to identify objects inside the same context.
|
static |
Create a Generic Binary Object from a given file.
The MIME type can be set automatically based on file extension.
parent | Parent object reference. |
name | The tree object name to be set for the object. |
context | User-defined context string. Should be used to group the same type of GBOs. |
id | User-defined ID string. Should be used to identify GBOs inside the same context. |
filePath | Path to the file from which to read the data. |
gbo | Returns the new Generic Binary Object. |
mimeType | Optional MIME type. If left empty, it will be derived from the file extension. |
|
static |
Create a GenericBinaryObject from a custom data source.
You need to provide a custom implementation of the LSBinaryReader interface. Please keep in mind that this implementation is not suited for very large data that does not easily fit into the computers main memory. For very big objects, we recommend to use the file based interface for creation.
parent | The parent object reference. |
name | The name to be set for the GenericBinaryObject. |
context | User-defined context string. Should be used to group the same type of GBOs. |
id | User-defined ID string. Should be used to identify GBOs inside the same context. |
mimeType | MIME type string for the data. Example: "image/jpeg" |
source | An LSBinaryReader instance you need to implement for providing the binary data. |
gbo | Returns the new created GenericBinaryObject. |