SqueezeBrains SDK 1.13
cs_common.h
1#pragma once
2namespace sb_cs
3{
13 public enum class SbError :int {
149 //N.B. Fino a 251999 i codici di errore sono riservati ai socket SB_ERR_SOCKET_xxxxx
150 // Se si cambia modificare anche la funzione sb_err_socket
170 }; // group_cs_error
172
180 public enum class SbDeviceType :int
181 {
184 };
185 String^ SbDeviceTypeFormat(SbDeviceType type);
186
190 public ref class SbCommon
191 {
192 public:
204 String^ ErrorMsg();
212 static String^ FormatError(SbError error);
213 internal:
215 };
216
220 public ref class SbTime
221 {
222 public:
227 signed long long Get();
232 void Set(signed long long sec);
239 String^ ToString() override;
240 SbTime();
245 SbTime(signed long long sec);
246 internal:
247 signed long long sec = 0;
248 };
249
257 public ref class SbDefines
258 {
259 public:
264 static const String^ SbSolutionExt = SB_SOLUTION_EXT;
269 static const String^ SbDlWeightsExt = SB_DL_WEIGHTS_EXT;
284 static String^ SbDelimiter = SB_DELIMITER;
285 }; // group_cs_defines
287
288 sb_t_err sb_trace_printf(int type, int code, const char* p_file, const char* p_function, int line, const char* p_format, ...);
289 #define sb_trace_inf(p_format, ...) sb_trace_printf(0, 0, __FILE__, __FUNCTION__, __LINE__, p_format, ##__VA_ARGS__)
290 #define sb_trace_err(p_format, ...) sb_trace_printf(2, 0, __FILE__, __FUNCTION__, __LINE__, p_format, ##__VA_ARGS__)
291
292 #define CHECK_NULL_RETURN(ptr) { if (!(ptr)) { \
293 sb_trace_err("%s is NULL pointer", #ptr); \
294 return SbError::SB_ERR_NULL_POINTER; \
295 } \
296 }
297 #define CHECK_FN_RETURN_ERR(function){ SbError __err; \
298 __err = function; \
299 if (__err != SbError::SB_ERR_NONE) { \
300 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
301 return(__err); \
302 } \
303 }
304 #define CHECK_FN_RETURN_AND_SET_ERR(function){ SbError __err; \
305 __err = function; \
306 if (__err != SbError::SB_ERR_NONE) { \
307 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
308 error = __err; \
309 return(__err); \
310 } \
311 }
312 #define CHECK_FN_RETURN_NULL(function){ SbError __err; \
313 __err = function; \
314 if (__err != SbError::SB_ERR_NONE) { \
315 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
316 return(nullptr); \
317 } \
318 }
319 #define CHECK_FN_RETURN_NULL_AND_SET_ERR(function){ SbError __err; \
320 __err = function; \
321 if (__err != SbError::SB_ERR_NONE) { \
322 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
323 error = __err; \
324 return(nullptr); \
325 } \
326 }
327 // group_cs
329}
Common class
Definition: cs_common.h:191
String ErrorMsg()
Returns the error message of the last operation.
static String FormatError(SbError error)
Returns the error message.
SbError Error()
Returns the error code of the last operation. If no error SbError.SB_ERR_NONE is returned.
Defines class
Definition: cs_common.h:258
static String SbDelimiter
Delimiter of the field in a string
Definition: cs_common.h:284
static int SbDevicesMaxNumber
Maximum number of computational devices managed by the sb library.
Definition: cs_common.h:279
static const String SbSolutionExt
Solution file extension
Definition: cs_common.h:264
static const String SbDlWeightsExt
Extension of the Squeezebrains pre - trained network weights file
Definition: cs_common.h:269
static float SbValueNotSet
Value of the prediction in case it is undefined.
Definition: cs_common.h:274
Time class
Definition: cs_common.h:221
void Set(signed long long sec)
Set the time.
signed long long Get()
Returns the time.
SbTime(signed long long sec)
Constructor.
String ToString() override
Formats time in a readable string.
SbError
Enum error codes
Definition: cs_common.h:13
@ SB_ERR_SOCKET_RECEIVE
Socket receive function has returned an error.
@ SB_ERR_IMAGE_CIRCULARITY
The image circularity type is wrong.
@ SB_ERR_PROJECT_LOAD_MODE
The project was loaded with the wrong load parameter.
@ SB_ERR_IMAGE_CHANNELS
The image has a wrong number of channels.
@ SB_ERR_THREAD
Thread management error.
@ SB_ERR_DL_PRE_TRAINED_FILE_NOT_FOUND
Deep Learning pre-trained file not found.
@ SB_ERR_LIBRARY_FUNCTION_ADDRESS
Could not locate the function.
@ SB_ERR_NONE
No errors.
@ SB_ERR_SOCKET_ACCEPT
Socket accept has returned an error.
@ SB_ERR_VERSION_FORMAT
Version is not formatted properly.
@ SB_ERR_IMAGE_RESOLUTION
The image has a wrong resolution.
@ SB_ERR_LICENSE_NOT_FOUND
License key not found.
@ SB_ERR_SENTINEL
Sentinel key returns an error.
@ SB_ERR_INITIALIZE
You must call the initialize function.
@ SB_ERR_FILE_WRITE
An error occurred writing the file.
@ SB_ERR_SVL_CHOOSE_FEATURES_FAST
Choose features failed to find a common combination for fast.
@ SB_ERR_FILE_NOT_EXIST
The file doesn't exist.
@ SB_ERR_NO_CLASSIFIED_IMAGE
There aren't classified images.
@ SB_ERR_FILE_NAME_LENGHT
File name too long.
@ SB_ERR_DL_PRE_TRAINED_FILE_NOT_VALID
Deep Learning pre-trained file is not valid.
@ SB_ERR_IMAGE_RESIZE
Image resize function returns an error.
@ SB_ERR_FILE_OPEN
An error occurred opening the file.
@ SB_ERR_SENTINEL_MASTER_KEY
Sentinel LDK Master key not present.
@ SB_ERR_IMAGE_WARP
Image warp function returns an error.
@ SB_ERR_SAMPLE_NOT_FOUND
No sample found.
@ SB_ERR_IMAGE_FORMAT
The image format is wrong.
@ SB_ERR_DECRYPT
An error occurred decrypting data.
@ SB_ERR_STRING_UTF8
String does not conform to UTF-8 format.
@ SB_ERR_FILE_VERSION
The file has no version.
@ SB_ERR_SOCKET_SET_PARAMETER
Set socket parameter has returned an error.
@ SB_ERR_SOCKET_TIMEOUT
Timeout sending or receiving data on socket.
@ SB_ERR_PATH_SIZE
the path name exceeds the maximum size
@ SB_ERR_IMAGE_SIZE
Image has a wrong data size.
@ SB_ERR_MODEL_NAME
There are two models with the same name.
@ SB_ERR_LICENSE_MACHINE_ID_MATCH
Machine id doesn't match.
@ SB_ERR_SVL_WAS_NOT_DONE
The SVL wasn't done.
@ SB_ERR_SENTINEL_RUN_TIME
Sentinel_LDK_Run-time is not running.
@ SB_ERR_PROJECT_NOT_FOUND
Project not found.
@ SB_ERR_SAMPLE_OUT_OF_IMAGE
The sample is out of image.
@ SB_ERR_DL_TRAINING_DATA_MISSING
Deep Learning training data missing.
@ SB_ERR_SOCKET_INVALID_IP
IP address is invalid.
@ SB_ERR_FILE_FORMAT
Wrong data file format.
@ SB_ERR_SVL_WRONG
SVL is wrong.
@ SB_ERR_IMAGE_DECODE
An error occurred decoding image.
@ SB_ERR_LICENSE_VERSION
License is incompatible with the library version.
@ SB_ERR_SAMPLE_WRONG
The sample has wrong data.
@ SB_ERR_ROI_DEFECTS
The defects ROI is wrong.
@ SB_ERR_SOCKET_SELECT
Socket select function has returned an error.
@ SB_ERR_LIBRARY_OPEN
Could not load the dynamic library or the shared object.
@ SB_ERR_SOCKET_BIND
An error occurred binding the socket.
@ SB_ERR_SCALE_NOT_FOUND
The scale is not found.
@ SB_ERR_FILE_REMOVE
Error removing a file.
@ SB_ERR_LICENSE_SAME_MACHINE_ID
Two licences have the same machine id.
@ SB_ERR_SVL_CHOOSE_FEATURES
Choose features failed to find a good combination.
@ SB_ERR_DL_INPAINTER_NOT_FOUND
Deep Learning inpainter network file not found.
@ SB_ERR_NO_FEATURES_AVAILABLE
No features available for the data set.
@ SB_ERR_FILE_EMPTY
File is empty.
@ SB_ERR_CLS
The function of a classifier has returned an error.
@ SB_ERR_SVL_PERTURBATION
A perturbation has not been defined properly.
@ SB_ERR_DL_INPAINTER_NOT_ASSIGNED
Deep Learing Inpainter network path is not assigned.
@ SB_ERR_MODEL_NOT_FOUND
The model of the sample is unknown or not assigned.
@ SB_ERR_NOT_IMPLEMENTED
The function isn't implemented.
@ SB_ERR_WARP_POINT_NOT_FOUND
Point isn't found in the lut.
@ SB_ERR_LICENSE_MARKER
Marker of the TCP/IP license protocol is wrong.
@ SB_ERR_DL_NETWORK_FILE_NOT_FOUND
Deep Learning Network file not found.
@ SB_ERR_NO_FILE_FOUND
No file found in the folder.
@ SB_ERR_SAMPLE_NUMBER
Too few samples to execute the training.
@ SB_ERR_SVL_VALIDATION_DATASET
The SVL images dataset is too small to extract a validation dataset.
@ SB_ERR_SOCKET_MAC
Error while looking for a valid MAC address.
@ SB_ERR_STRUCT_HEADER_WRONG_VERSION
The version of the structure sb_t_struct_header is wrong.
@ SB_ERR_DIR_REMOVE
An error occurred removing the folder.
@ SB_ERR_LICENSE_DISABLED
License is disabled.
@ SB_ERR_DL_FRAMEWORK
Impossible to execute the requested operation: Deep Learning Framework not installed or corrupted.
@ SB_ERR_IMAGE_DEPTH
The image has a wrong bit depth.
@ SB_ERR_BUFFER_SIZE
The buffer has an insufficient size.
@ SB_ERR_SAMPLE_DISTANCE
There are two samples closer than the minimum distance set.
@ SB_ERR_NO_POINT_FOUND
Point isn't found.
@ SB_ERR_INSUFFICIENT_FREE_MEMORY
Insufficient free memory to complete the svl.
@ SB_ERR_FILE_COPY
Error copying a file.
@ SB_ERR_LICENSE
The license isn't valid.
@ SB_ERR_SAMPLE_BACKGROUND
Too few background samples to execute the training. Increase the analysis ROI or reduce the scale.
@ SB_ERR_MODEL_NOT_TRAINED
The model is not trained.
@ SB_ERR_CLS_CREATE
The function for the creation of the classifier has returned an error.
@ SB_ERR_SOCKET_LISTEN
Socket listen function has returned an error.
@ SB_ERR_WRONG_PARAMETER
The function has been called with a parameter with a wrong value.
@ SB_ERR_CLS_PREDICT
The predict function has returned an error.
@ SB_ERR_LICENSE_WAIT_SERVER
Waiting to contact the license server.
@ SB_ERR_LICENSE_TYPE
The license type is unknown.
@ SB_ERR_ROI_BOUNDING_BOX
Wrong roi bounding box.
@ SB_ERR_LIBRARY_DEPENDENCIES
Library dependencies not satisfied to execute the requested operation.
@ SB_ERR_DIR_CREATE
An error occurred creating the folder.
@ SB_ERR_LICENSE_TRAINING
License error: training is disabled.
@ SB_ERR_IMAGE_COMPRESSION
The image compression type is wrong.
@ SB_ERR_SOCKET_INVALID_PORT
Port isn't a valid number.
@ SB_ERR_IMAGE_ENCODE
An error occurred encoding image.
@ SB_ERR_CLS_NOT_TRAINED
The training wasn't done.
@ SB_ERR_DIR_NOT_EXIST
The directory doesn't exist.
@ SB_ERR_FILE_NAME
Wrong file name: too long or unknown extension.
@ SB_ERR_SAMPLES_GT_TOO_MANY
Too many ground truth samples.
@ SB_ERR_UUID
The generation of UUID has returned an error or invalid UUID.
@ SB_ERR_LICENSE_MAIL_ADDRESS
Mail address in the license file is wrong.
@ SB_ERR_ENCRYPT
An error occurred encrypting data.
@ SB_ERR_MEMORY_LEAK
There is a memory leak.
@ SB_ERR_FILE_NAME_EMPTY
File name is empty.
@ SB_ERR_LICENSE_FILE
License file error (not exist, not readable, wrong format, wrong mail address)
@ SB_ERR_LICENSE_CODE
Code of the TCP/IP license protocol is wrong.
@ SB_ERR_IMAGE_TYPE
Unknown image type, should be a sb_t_image_info_type enum value.
@ SB_ERR_FILE_SAVE
An error occurred saving the file.
@ SB_ERR_LICENSE_FEATURES_NUMBER
Number of features is greater than the maximum allowed for the current license configuration.
@ SB_ERR_NULL_POINTER
Function has been called with a NULL pointer.
@ SB_ERR_STRING_EMPTY
String empty.
@ SB_ERR_RPF_NAME_EMPTY
The name of solution file is empty.
@ SB_ERR_DL_ROI_NOT_SET
Not enough ROI analysis area in SVL or validation image dataset. Increase the analysis ROI or the til...
@ SB_ERR_LEVELS_ENABLED
There are no levels enabled.
@ SB_ERR_SOCKET_CREATE
An error occurred creating the socket.
@ SB_ERR_IMAGE_WIDTH_STEP
Image has a wrong width_step value.
@ SB_ERR_SOCKET_CONNECT
An error occurred connecting the socket.
@ SB_ERR_STRUCT_HEADER_WRONG_SIZE
The dimension of the structure sb_t_struct_header is wrong.
@ SB_ERR_LICENSE_CORRUPTED
License file is corrupted.
@ SB_ERR_MODELS_NUMBER
There aren't models, or the number of the models isn't the expected one, or exceeded the maximum mode...
@ SB_ERR_NVIDIA_NVML
Nvidia NVML returns an error getting gpu information.
@ SB_ERR_MACHINE_ID
Machine id has a wrong format.
@ SB_ERR_LEVELS_NUMBER
There aren't levels, or the number of the levels isn't the expected one, or exceeded the maximum leve...
@ SB_ERR_STRUCT_HEADER_WRONG_CODE
The code of the structure sb_t_struct_header is wrong.
@ SB_ERR_DIR_EXIST
Checking the existence of the folder gave error.
@ SB_ERR_DL_INTERNAL
Internal Deep Learning error.
@ SB_ERR_IMAGE_CREATE
An error occurred creating the image.
@ SB_ERR_NO_LEVELS_AVAILABLE
No levels available to be processed.
@ SB_ERR_IMAGE_LOAD
An error occurred loading the image.
@ SB_ERR_SENTINEL_TOO_MANY_KEYS
Too many keys connected to the pc.
@ SB_ERR_PROJECT_TYPE
Wrong project type.
@ SB_ERR_CLS_TRAINING
The training function has returned an error.
@ SB_ERR_DL_NOT_SUPPORTED
Deep Learning module are not supported.
@ SB_ERR_SOCKET_CLOSED
Socket is closed.
@ SB_ERR_LICENSE_VM
License isn't allowed on Virtual Machine.
@ SB_ERR_SOCKET
A socket function has returned an error.
@ SB_ERR_XML
Error parsing xml file.
@ SB_ERR_FILE_EXTENSION
Wrong file extension.
@ SB_ERR_VERSION
Unmanaged version.
@ SB_ERR_SOCKET_IOCTL
Socket ioctl function has returned an error.
@ SB_ERR_MODEL_DISABLED
A model is disabled.
@ SB_ERR_INVALID_MAIL_ADDRESS
Mail address has a wrong format.
@ SB_ERR_ROI
The ROI is wrong.
@ SB_ERR_SOCKET_SEND
Socket send function has returned an error.
@ SB_ERR_FILE_READ
An error occurred reading the file.
@ SB_ERR_LICENSE_MODELS_NUMBER
Number of models is greater than the maximum allowed for the current license configuration.
@ SB_ERR_BASE64_SIZE
The dimension of the base64 buffer isn't 4 bytes aligned.
@ SB_ERR_DL_CUDA_OUT_OF_MEMORY
CUDA Out Of Memory (OOM). Insufficient free GPU memory to execute the operation. Try reducing the bat...
@ SB_ERR_SAMPLE_SCALE
The sample scale is wrong.
@ SB_ERR_MALLOC
The function that allocates memory gave error
@ SB_ERR_MODELS_ENABLED
There are no models enabled.
@ SB_ERR_XML_NODE_NOT_FOUND
An xml node was not found.
@ SB_ERR_LICENSE_EXPIRED
License is expired.
@ SB_ERR_INTERNAL
Internal error.
SbDeviceType
Device type that wraps the sb_t_device_type enum
Definition: cs_common.h:181
@ SB_DEVICE_CPU
CPU device.
@ SB_DEVICE_GPU
GPU device.
sb_t_err
Errors code enum.
Definition: sb.h:5541
#define SB_VALUE_NOT_SET
Value of the prediction in case it is undefined.
Definition: sb.h:6261
#define SB_DELIMITER
Use this define as delimiter.
Definition: sb.h:5971
#define SB_SOLUTION_EXT
Extension of the SqueezeBrains solution file.
Definition: sb.h:8925
#define SB_DEVICES_MAX_NUMBER
Maximum number of computational devices managed by the sb library.
Definition: sb.h:10088
#define SB_DL_WEIGHTS_EXT
Extension of the SqueezeBrains pre-trained network weights file.
Definition: sb.h:9859
SB Namespace
Definition: cs_common.h:3