Volume Cartographer 2.27.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
volcart::DiskBasedObjectBaseClass Class Reference

Base class for objects stored on disk with an associated metadata file. More...

#include <vc/core/types/DiskBasedObjectBaseClass.hpp>

Inheritance diagram for volcart::DiskBasedObjectBaseClass:
[legend]
Collaboration diagram for volcart::DiskBasedObjectBaseClass:
[legend]

Public Types

using Identifier = std::string
 Identifier type. More...
 
using Description = std::pair< Identifier, std::string >
 

Public Member Functions

 DiskBasedObjectBaseClass ()=delete
 
Identifier id () const
 Get the "unique" ID for the object.
 
auto path () const -> filesystem::path
 Get the path to the object.
 
auto name () const -> std::string
 Get the human-readable name for the object.
 
void setName (std::string n)
 Set the human-readable name of the object.
 
template<typename T >
void setMetadataEntry (const std::string &key, T value)
 Set a metadata entry. More...
 
template<typename T >
auto getMetadataEntry (const std::string &key) const -> std::optional< T >
 Get a metadata entry. More...
 
void saveMetadata () const
 Update metadata on disk.
 

Protected Member Functions

 DiskBasedObjectBaseClass (filesystem::path path)
 
 DiskBasedObjectBaseClass (filesystem::path path, Identifier uuid, std::string name)
 

Protected Attributes

Metadata metadata_
 
filesystem::path path_
 

Detailed Description

Base class for objects stored on disk with an associated metadata file.

Author
Seth Parker

Disk-based objects are meant to be used for objects stored inside of a VolumePkg that need to be unique and identifiable, like Segmentations, Renders, and Volumes. The goal of such objects is to make it easier to access data from within the complex structure of a VolumePkg.

As its name implies, a disk-based object is associated with a specific file or directory on disk from which it loads and into which it saves data. Derived classes are responsible for the process of updating this information.

Definition at line 25 of file DiskBasedObjectBaseClass.hpp.

Member Typedef Documentation

◆ Description

ID/Name pair

Definition at line 32 of file DiskBasedObjectBaseClass.hpp.

◆ Identifier

Identifier type.

Definition at line 29 of file DiskBasedObjectBaseClass.hpp.

Constructor & Destructor Documentation

◆ DiskBasedObjectBaseClass() [1/3]

volcart::DiskBasedObjectBaseClass::DiskBasedObjectBaseClass ( )
delete

Default constructor

◆ DiskBasedObjectBaseClass() [2/3]

volcart::DiskBasedObjectBaseClass::DiskBasedObjectBaseClass ( filesystem::path  path)
explicitprotected

Load the object from file

◆ DiskBasedObjectBaseClass() [3/3]

volcart::DiskBasedObjectBaseClass::DiskBasedObjectBaseClass ( filesystem::path  path,
Identifier  uuid,
std::string  name 
)
protected

Make a new object

Member Function Documentation

◆ getMetadataEntry()

template<typename T >
auto volcart::DiskBasedObjectBaseClass::getMetadataEntry ( const std::string &  key) const -> std::optional<T>
inline

Get a metadata entry.

See also
Metadata::get

Definition at line 72 of file DiskBasedObjectBaseClass.hpp.

◆ setMetadataEntry()

template<typename T >
void volcart::DiskBasedObjectBaseClass::setMetadataEntry ( const std::string &  key,
value 
)
inline

Set a metadata entry.

See also
Metadata::set
Warning
This provides direct access to the underlying metadata object, making it possible to manually override metadata values for standard VC types (e.g. Volume, Segmentation, Render). This can lead to unexpected behavior if you modify one of the required metadata entries incorrect. Prefer to use the metadata setter functions provided by child classes.

Definition at line 61 of file DiskBasedObjectBaseClass.hpp.

Member Data Documentation

◆ metadata_

Metadata volcart::DiskBasedObjectBaseClass::metadata_
protected

Metadata

Definition at line 89 of file DiskBasedObjectBaseClass.hpp.

◆ path_

filesystem::path volcart::DiskBasedObjectBaseClass::path_
protected

Location for the object on disk

Definition at line 92 of file DiskBasedObjectBaseClass.hpp.


The documentation for this class was generated from the following file: