src.pcloud.mem_to_file_proxy

Classes

MemToFileProxy([mem_check_threshold])

class src.pcloud.mem_to_file_proxy.MemToFileProxy(mem_check_threshold=None)
Author:

Alberto M. Esmoris Pena

Class representing a proxy between point clouds loaded in memory and a binary file in persistent storage representing them. The proxy must support the operation of loading a point cloud from its binary representation, the operation of saving a point cloud from its binary representation, and the logic to check when the data of a given point cloud must be dumped to save memory sources.

Variables:
  • mem_check_threshold (float) – Decimal number inside [0, 1] that determines the cut value (threshold) of occupied memory that is acceptable before dumping the point cloud’s data. More concretely, when the memory required by the point cloud’s data divided by the system’s memory is greater than this threshold, dumping the point cloud data will be recommended.

  • proxy_file (None or file object) – The binary proxy file where the point cloud’s data is stored.

__init__(mem_check_threshold=None)
dump(pcloud)

Dump the given point cloud’s data to the binary proxy file.

Parameters:

pcloud (PointCloud) – The point cloud which data must be dumped.

load(pcloud)

Load the data from the binary proxy file into the given point cloud.

Parameters:

pcloud (PointCloud) – Point cloud for which the data in the proxy file must be loaded.

release()

Discards the proxy file, if any. This means closing the file and removing the reference.

Check whether dumping the given point cloud is recommended (True) or not (False). A point cloud must be dumped when the memory it requires is greater than self.mem_check_threshold considering the system’s memory.

See SysUtils and SysUtils.get_sys_mem().

Parameters:

pcloud (PointCloud) – The point cloud to be checked.

Returns:

True if the given point cloud should be dumped, False otherwise.

Return type:

bool

is_dumped()

Check whether the proxy is representing a dumped point cloud or not.

Returns:

True if the proxy holds a dumped point cloud, false otherwise.

Return type:

bool