Pylon::CPylonDataContainer#
#include <pylon/PylonDataContainer.h>
Public Functions#
| Name | |
|---|---|
| CPylonDataContainer(const CGrabResultPtr & ptrGrabResult) Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) from a given [CGrabResultPtr](class_pylon_1_1_c_grab_result_ptr.md). | |
| CPylonDataContainer(const GrabResult & grabResult) Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) from a given [GrabResult](). | |
| CPylonDataContainer(const Pylon::String_t & filename) Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) by loading the data from the file passed. | |
| CPylonDataContainer() Creates an empty [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md). | |
| CPylonDataContainer(const CPylonDataContainer & rhs) Creates a shallow copy of an existing [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md). | |
| ~CPylonDataContainer() Destroys the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) instance. If the instance has been created through a GrabResultPtr, the reference to that [CGrabResultData](class_pylon_1_1_c_grab_result_data.md) will be released. | |
| CPylonDataContainer & | operator=(const CPylonDataContainer & rhs) Assigns a shallow copy of the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) to this instance. |
| size_t | GetDataComponentCount() const Returns the number of components contained in the container. |
| const CPylonDataComponent | GetDataComponent(const size_t index) const Returns a specific component from the container. |
| void | Save(const Pylon::String_t & filename) const Saves the container to disk. |
| void | Load(const Pylon::String_t & filename) Loads a container from a file. |
Detailed Description#
class Pylon::CPylonDataContainer;
Provides methods for accessing grab results consisting of multiple components.
Attention: Any [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) or [CPylonDataComponent](class_pylon_1_1_c_pylon_data_component.md) will hold a reference to the [CGrabResultData](class_pylon_1_1_c_grab_result_data.md) from which it has been created. To allow the instant camera to reuse the [CGrabResultData](class_pylon_1_1_c_grab_result_data.md) and prevent buffer underruns, you must destroy the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) and all its [CPylonDataComponent](class_pylon_1_1_c_pylon_data_component.md) objects.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Some cameras can return complex grab results consisting of multiple components. For example, Basler blaze cameras return a data stream that is composed of range, intensity, and confidence components. To access the individual components, you can use the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) class.
A [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) can hold one or more components. You can obtain a container by calling [Pylon::CGrabResultData::GetDataContainer()](class_pylon_1_1_c_basler_universal_grab_result_data.md#function-pyloncgrabresultdatagetdatacontainer). You can then use the container to query for the number of components by calling [Pylon::CGrabResultData::GetDataComponentCount()](class_pylon_1_1_c_basler_universal_grab_result_data.md#function-pyloncgrabresultdatagetdatacomponentcount). To retrieve a specific component, you can call [Pylon::CGrabResultData::GetDataComponent()](class_pylon_1_1_c_basler_universal_grab_result_data.md#function-pyloncgrabresultdatagetdatacomponent). Each component in the container can be used to access the actual data, e.g., the range values, and its metadata.
Public Functions Documentation#
CPylonDataContainer#
explicit CPylonDataContainer(
const CGrabResultPtr & ptrGrabResult
)
Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) from a given [CGrabResultPtr](class_pylon_1_1_c_grab_result_ptr.md).
Parameters:
- ptrGrabResult The grab result to create a container from.
Postcondition:
- A new reference to the grab result passed in ptrGrabResult has been set.
Error Safety:
Does not throw an exception if the [CGrabResultPtr](class_pylon_1_1_c_grab_result_ptr.md) was invalid or points to an invalid/unsuccessful result. Instead, an empty container is returned. Can throw exceptions if the data in the result is invalid or malformed. Can throw exceptions in low-memory conditions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) from a given [CGrabResultPtr](class_pylon_1_1_c_grab_result_ptr.md). The [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) instance created will hold a reference to the [CGrabResultData](class_pylon_1_1_c_grab_result_data.md) from which it has been created. To allow the instant camera to reuse the grab result and prevent buffer underruns, you must destroy the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md).
CPylonDataContainer#
explicit CPylonDataContainer(
const GrabResult & grabResult
)
Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) from a given [GrabResult]().
Parameters:
- grabResult The grab result to create a container from.
Error Safety:
Does not throw an exception if the GrabResult contains an unsuccessful result. Instead, an empty container is returned. Can throw exceptions if the data in the buffer of the GrabResult is invalid or malformed. Can throw exceptions in low-memory conditions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) from a given [GrabResult](class_pylon_1_1_grab_result.md). The [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) instance created is only valid as long as the associated buffer is not queued or deregistered and deleted.
CPylonDataContainer#
explicit CPylonDataContainer(
const Pylon::String_t & filename
)
Creates a [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) by loading the data from the file passed.
Parameters:
- filename Name and path of the file to load.
Postcondition:
- The reference to a previous grab result or buffer has been released.
- A new buffer has been allocated to hold the data loaded.
Error Safety:
Throws an exception if the container cannot be read. Throws an exception if the contents of the file does not contain a valid container.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Loads a container and all its components from a file on disk.
CPylonDataContainer#
CPylonDataContainer()
Creates an empty [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md).
Error Safety:
Can throw exceptions in low-memory conditions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Creates an empty [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md). The [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) instance created will not be valid.
CPylonDataContainer#
CPylonDataContainer(
const CPylonDataContainer & rhs
)
Creates a shallow copy of an existing [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md).
Parameters:
- rhs Container to copy from.
Postcondition:
- A new reference to the grab result or buffer of the container passed in rhs has been set.
Error Safety:
Can throw exceptions in low-memory conditions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
~CPylonDataContainer#
~CPylonDataContainer()
Destroys the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) instance. If the instance has been created through a GrabResultPtr, the reference to that [CGrabResultData](class_pylon_1_1_c_grab_result_data.md) will be released.
Postcondition:
- The reference to a grab result or buffer has been released.
Error Safety:
Does not throw C++ exceptions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
operator=#
CPylonDataContainer & operator=(
const CPylonDataContainer & rhs
)
Assigns a shallow copy of the [CPylonDataContainer](class_pylon_1_1_c_pylon_data_container.md) to this instance.
Parameters:
- rhs CPylonDataContainer to copy data from.
Return: Returns a reference to the current instance.
Postcondition:
- The reference to a previous grab result or buffer has been released.
- A new reference to the grab result or buffer of the container passed in rhs has been set.
Error Safety:
Can throw exceptions in low-memory conditions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
GetDataComponentCount#
size_t GetDataComponentCount() const
Returns the number of components contained in the container.
Return: Returns the number of components contained in the container.
Error Safety:
Does not throw C++ exceptions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
You can use the return value to iterate over the existing components by calling [Pylon::CPylonDataContainer::GetDataComponent()](class_pylon_1_1_c_pylon_data_container.md#function-pyloncpylondatacontainergetdatacomponent).
GetDataComponent#
const CPylonDataComponent GetDataComponent(
const size_t index
) const
Returns a specific component from the container.
Parameters:
- index Index of the component to return. The index must be less than the value returned by
Pylon::CPylonDataContainer::GetComponentCount().
Return: Returns the component specified by the index parameter.
Error Safety:
Throws an exception if the index parameter is out of range. Can throw exceptions in low-memory conditions.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Save#
void Save(
const Pylon::String_t & filename
) const
Saves the container to disk.
Parameters:
- filename Name and path of the file to save the container to.
Precondition: The container must contain at least one component.
Error Safety:
Throws an exception if the container cannot be saved.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Load#
void Load(
const Pylon::String_t & filename
)
Loads a container from a file.
Parameters:
- filename Name and path of the file to load.
Postcondition:
- The reference to a previous grab result or buffer has been released.
- A new buffer has been allocated to hold the data loaded.
Error Safety:
Throws an exception if the container cannot be read. Throws an exception if the contents of the file does not contain a valid container.
Thread Safety:
This class is not thread-safe. If you access the same instance from multiple threads, you must make sure to synchronize the access accordingly.
Loads a container and all its components from a file on disk.
Updated on 27 July 2022 at 19:03:46