35#include "src/jazz_elements/block.h"
38#ifndef INCLUDED_JAZZ_CATCH2
39#define INCLUDED_JAZZ_CATCH2
41#include "src/catch2/catch.hpp"
47#ifndef INCLUDED_JAZZ_ELEMENTS_KIND
48#define INCLUDED_JAZZ_ELEMENTS_KIND
109 if (idx < 0 || idx >=
size)
122 for (
int idx = 0; idx <
size; idx++) {
135 for (
int i = 0; i <
size; i++) {
138 for (
int j = 0; j < p_it_hea->
rank; j++) {
139 int k = p_it_hea->
dim[j];
162 if (num_items < 1 || num_items > MAX_ITEMS_IN_KIND)
163 return SERVICE_ERROR_WRONG_ARGUMENTS;
168 rq_sz += 2*att->size();
170 if (num_bytes < rq_sz)
171 return SERVICE_ERROR_NO_MEM;
184 return SERVICE_NO_ERROR;
211 if (idx < 0 || idx >=
size)
220 for (
int i = MAX_TENSOR_RANK - 1; i >= 0; i--) {
222 p_it_hea->
dim[i] = j;
230 if (p_dims ==
nullptr)
233 AttributeMap::iterator it = p_dims->find(j);
234 if (it == p_dims->end())
239 if (k <= STRING_EMPTY)
242 p_it_hea->
dim[i] = -k;
248 if (p_it_hea->
name <= STRING_EMPTY)
271 int num_lines = 1, j = 0;
272 for (
char const *p = p_def; *p; p++) {
274 if (j >=
sizeof(
Name))
275 return SERVICE_ERROR_WRONG_ARGUMENTS;
283 if (j >=
sizeof(
Name))
284 return SERVICE_ERROR_WRONG_ARGUMENTS;
289 rq_sz += 2*att->size();
291 if (rq_sz > num_bytes)
292 return SERVICE_ERROR_NO_MEM;
307 for (
char const *p = p_def; *p; p++) {
320 return SERVICE_NO_ERROR;
A block is a moveable BlockHeader followed by a Tensor and a StringBuffer.
Definition block.h:99
int get_string_offset(pStringBuffer psb, const char *p_str)
Definition block.cpp:128
void set_string(int *p_idx, const char *p_str)
Definition block.h:217
pStringBuffer p_string_buffer()
Definition block.h:363
void set_attributes(AttributeMap *all_att)
Definition block.h:268
Kind: A type definition for Jazz Blocks and Tuples.
Definition kind.h:96
int audit()
Audit a Kind.
Definition kind.cpp:47
bool to_block_kind()
Definition kind.h:327
bool add_item(int idx, char const *p_name, int *p_dim, int cell_type, AttributeMap *p_dims)
Definition kind.h:205
int new_kind(int num_items, int num_bytes, AttributeMap *att=nullptr)
Definition kind.h:158
int new_object_kind(int num_bytes, char const *p_def, char sep, AttributeMap *att=nullptr)
Definition kind.h:266
char * item_name(int idx)
Definition kind.h:108
void dimensions(Dimensions &dims)
Definition kind.h:134
int index(pChar name)
Definition kind.h:121
The namespace for Jazz Utils, Blocks, Kinds, Tuples, Containers, etc.
Definition block.cpp:39
std::string String
A standard string used in many other places in Jazz.
Definition types.h:239
std::set< String > Dimensions
An set::set with the dimension names returned by kind.dimensions()
Definition types.h:241
Kind * pKind
A pointer to a Kind object.
Definition kind.h:337
char * pChar
A pointer to a char buffer.
Definition types.h:189
char Name[NAME_SIZE]
A short identifier used in Blocks, Containers and API.
Definition types.h:187
std::map< int, const char * > AttributeMap
An stdlib map to store all the attributes of a Block at the same time used by the some Block methods.
Definition block.h:63
Structure at the end of a Block, initially created with init_string_buffer()
Definition types.h:287
char buffer[]
The buffer where strings are stored starting with two zeroes for STRING_NA & STRING_EMPTY.
Definition types.h:292
int dim[MAX_TENSOR_RANK]
Dimensions for the Tensor. The product of all * (cell_type & 0xff) < 2 Gb.
Definition types.h:197
ItemHeader cell_item[0]
.. An array of BlockHeader used by Kinds and Tuples
Definition types.h:235