NDEVR
API Documentation
DatasetManager.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Dictionary.h>
4#include <NDEVR/String.h>
5#include <NDEVR/TranslatedString.h>
6namespace NDEVR
7{
8 class Model;
12 class Dataset
13 {
14 public:
18 virtual ~Dataset(){}
23 virtual String name() const = 0;
28 virtual String icon() const { return String(); }
33 virtual TranslatedString title() const { return TranslatedString(); }
38 virtual TranslatedString description() const { return TranslatedString(); }
43 virtual Bounds<3, fltp08> bounds() const { return Constant<Bounds<3, fltp08>>::Invalid; }
49 virtual bool setupModel(Model&) { return false; };
60 virtual Dataset* child(const String&) { return nullptr; };
65 virtual uint04 childCount() const { return 0; };
66 };
67
71 class NDEVR_DESIGN_API DatasetManager
72 {
73 public:
79 {
80 m_sources.add(source->name(), source);
81 };
82
88 {
89 auto iter = m_sources.find(name);
90 if(iter != m_sources.end())
91 return iter.value();
92 return nullptr;
93 };
94
99 bool hasSource(const StringView& name) const
100 {
101 return m_sources.hasKey(name);
102 }
103
109 };
110
111
112 constexpr StringView ZIP_CODE_DATASET = "Zip Codes";
113 constexpr StringView US_STATE_DATASET = "US States";
114}
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:54
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Used to group datasets (DEPRECIATED).
bool hasSource(const StringView &name) const
Checks whether a dataset source with the given name exists.
static DatasetManager & DefaultManager()
Returns the singleton default DatasetManager instance.
Dictionary< String, Dataset * > m_sources
Maps dataset names to their Dataset pointers.
void addSource(Dataset *source)
Registers a dataset source with this manager, keyed by its name.
Dataset * source(const StringView &name)
Looks up a dataset source by name.
Forward declaration of the Model class.
virtual TranslatedString title() const
Returns the user-facing translated title of this dataset.
virtual bool setupModel(Model &)
Configures the given Model using data from this dataset.
virtual ~Dataset()
Destructor.
virtual TranslatedString description() const
Returns a translated description of this dataset.
virtual Buffer< Dataset * > children()
Returns all child datasets contained within this dataset.
virtual uint04 childCount() const
Returns the number of child datasets.
virtual String icon() const
Returns the icon resource name associated with this dataset.
virtual Bounds< 3, fltp08 > bounds() const
Returns the 3D spatial bounding box of this dataset.
virtual Dataset * child(const String &)
Retrieves a child dataset by name.
virtual String name() const =0
Returns the unique name identifier for this dataset.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
A core class that represents a node on model hierarchy.
Definition Model.h:292
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
@ name
The display name of the object.
constexpr StringView US_STATE_DATASET
Dataset name constant for US state boundary data.
constexpr StringView ZIP_CODE_DATASET
Dataset name constant for US zip code data.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...