Jazz 1.25.+
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
jazz_bebop::Space Class Reference

Space: The abstract space. More...

#include <space.h>

Inheritance diagram for jazz_bebop::Space:
jazz_elements::Service

Public Member Functions

 Space (pBaseAPI api, pName a_name)
 Bop: Create the Space.
 
virtual StatusCode start ()
 
virtual StatusCode shut_down ()
 
virtual StatusCode load_meta ()
 Load the metadata of the Space.
 
virtual StatusCode save_meta ()
 Save the metadata of the Space.
 
virtual RowNumber num_rows ()
 Return the number of rows in the Space.
 
virtual void * get_index_data (RowNumber row)
 Get a pointer to the data of the index of a given row.
 
virtual int num_cols ()
 Get the number of columns in the Space.
 
virtual pName col_name (int col)
 Get the name of a column.
 
virtual int col_index (pName name)
 Get the index of a column.
 
virtual pLocator locator (RowNumber row, int col, int &index)
 Get the location of a cell as a Locator.
 
virtual pRowSelection where (pChar query)
 Get a RowSelection from a query.
 
virtual pColSelection select (pChar query)
 Get a ColSelection from a query.
 
virtual pCaster as (pChar query)
 Get the appropriate Caster from the AS clause of a query.
 
virtual bool register_caster (pCaster cast)
 Register a Caster descendant to make it available in queries.
 
virtual StatusCode get_row (pTransaction &p_txn, RowNumber row, pColSelection cols=nullptr, pCaster cast=nullptr)
 Get a row from the Space as a Tuple.
 
- Public Member Functions inherited from jazz_elements::Service
 Service (pLogger a_logger, pConfigFile a_config)
 
virtual pChar const id ()
 
void log (int loglevel, const char *message)
 
void log_printf (int loglevel, const char *fmt,...)
 
bool get_conf_key (const char *key, int &value)
 
bool get_conf_key (const char *key, double &value)
 
bool get_conf_key (const char *key, std::string &value)
 

Protected Attributes

char storage_base [SHORT_NAME_SIZE]
 The base name of the storage container.
 
Name name
 The name of the Space.
 
pBaseAPI p_api
 A pointer to the BaseAPI that provides access to containers.
 
Casters casters
 A map of all the available Casters.
 

Additional Inherited Members

- Data Fields inherited from jazz_elements::Service
pLogger p_log
 The logger.
 
pConfigFile p_conf
 The configuration file.
 

Detailed Description

Space: The abstract space.

This is the abstract parent of DataSpaces, Fields/SemSpaces and Snippet/Concept. A Space is an abstraction over many blocks that provides:

Through inheritance, it provides su things as:

The class Space is mostly empty. It provides the parent virtual interface and the parents of all the auxiliary classes used to access data.

See also
DataSpaces, Fields, SemSpaces, Snippet, Concept

Constructor & Destructor Documentation

◆ Space()

jazz_bebop::Space::Space ( pBaseAPI  api,
pName  a_name 
)

Bop: Create the Space.

Parameters
apiA pointer to a BaseAPI that provides access to containers.
a_nameThe name of the Space.

Member Function Documentation

◆ start()

StatusCode jazz_bebop::Space::start ( )
virtual

Starts the Space service

Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

Reimplemented from jazz_elements::Service.

◆ shut_down()

StatusCode jazz_bebop::Space::shut_down ( )
virtual

Shuts down the Space Service

Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

Reimplemented from jazz_elements::Service.

◆ load_meta()

virtual StatusCode jazz_bebop::Space::load_meta ( )
inlinevirtual

Load the metadata of the Space.

This method must be implemented by descendants. It will load a record of metadata from //storage_base/storage_ent/name.

Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

◆ save_meta()

virtual StatusCode jazz_bebop::Space::save_meta ( )
inlinevirtual

Save the metadata of the Space.

This method must be implemented by descendants. It will store a record of metadata into //storage_base/storage_ent/name.

Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

◆ num_rows()

virtual RowNumber jazz_bebop::Space::num_rows ( )
inlinevirtual

Return the number of rows in the Space.

Returns
The number of rows in the Space or SPACE_NOT_A_ROW if the Space is invalid.

◆ get_index_data()

virtual void * jazz_bebop::Space::get_index_data ( RowNumber  row)
inlinevirtual

Get a pointer to the data of the index of a given row.

Parameters
rowThe row number.
Returns
A pointer to the index or nullptr if there is no index. Examples include a vector for an embedding, of a string for a key-based index and a TimePoint for a time-based index.

◆ num_cols()

virtual int jazz_bebop::Space::num_cols ( )
inlinevirtual

Get the number of columns in the Space.

Returns
The number of columns in the Space.

◆ col_name()

virtual pName jazz_bebop::Space::col_name ( int  col)
inlinevirtual

Get the name of a column.

Parameters
colThe column index.
Returns
The name of the column or nullptr if the index is out of range.

◆ col_index()

virtual int jazz_bebop::Space::col_index ( pName  name)
inlinevirtual

Get the index of a column.

Parameters
nameThe name of the column.
Returns
The index of the column or -1 if the column is not found.

◆ locator()

virtual pLocator jazz_bebop::Space::locator ( RowNumber  row,
int  col,
int &  index 
)
inlinevirtual

Get the location of a cell as a Locator.

Parameters
rowThe row number.
colThe column index.
indexIf the block contains multiple rows, which is the index of row in the block.
Returns
A pointer to a Locator object that can be used to access the cell or nullptr if the cell is not found.

◆ where()

virtual pRowSelection jazz_bebop::Space::where ( pChar  query)
inlinevirtual

Get a RowSelection from a query.

Parameters
queryA query string that is understood by the descendant. In Bop, this is the content of a WHERE clause with a syntax that depends on how the Space is indexed (Time, categorical, Embedding storage, ...).
Returns
A RowSelection object that can be used to iterate over the rows that match the query.

◆ select()

virtual pColSelection jazz_bebop::Space::select ( pChar  query)
inlinevirtual

Get a ColSelection from a query.

Parameters
queryBy default, a list of comma separated column names. Spaces that use descendants of ColSelection may define a different interface.
Returns
A ColSelection object that can be used to iterate over the selected columns. If the query is invalid, the object will be invalid and return no columns. This is intentional since nullptr in a get_row() call means "all columns". An invalid query produces a selection of "no columns".

◆ as()

virtual pCaster jazz_bebop::Space::as ( pChar  query)
inlinevirtual

Get the appropriate Caster from the AS clause of a query.

Parameters
queryThe name of the Caster to get.
Returns
A pointer to the Caster or nullptr if the Caster is not found.

◆ register_caster()

virtual bool jazz_bebop::Space::register_caster ( pCaster  cast)
inlinevirtual

Register a Caster descendant to make it available in queries.

Parameters
castThe Caster to register.
Returns
True if the Caster was successfully registered, false if a Caster with the same name is already registered.

◆ get_row()

virtual StatusCode jazz_bebop::Space::get_row ( pTransaction p_txn,
RowNumber  row,
pColSelection  cols = nullptr,
pCaster  cast = nullptr 
)
inlinevirtual

Get a row from the Space as a Tuple.

Parameters
p_txnA transaction that will be used to get the result. It must be destroyed with: p_txn->p_owner->destroy_transaction(p_txn)
rowThe row number as obtained from a RowSelection.next() call.
colsPointer to a ColSelection to specify columns to be retrieved. If nullptr, all columns are retrieved.
castPointer to a Caster to convert the result. If nullptr, no conversion is done.
Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

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