LCOV - code coverage report
Current view: top level - data/source/set - data_node_set.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.57.0_covts Lines: 0 54 0.0 %
Date: 2024-04-07 11:14:42 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* File: data_node_set.c; Copyright and License: see below */
       2             : 
       3             : #include "set/data_node_set.h"
       4             : #include "u8/u8_trace.h"
       5             : #include <stdio.h>
       6             : #include <stdlib.h>
       7             : #include <assert.h>
       8             : 
       9           0 : void data_node_set_init( data_node_set_t *this_ )
      10             : {
      11           0 :     U8_TRACE_BEGIN();
      12           0 :     U8_TRACE_INFO_INT( "sizeof(data_node_set_t):", sizeof(data_node_set_t) );
      13             : 
      14           0 :     data_classifier_init_empty( &((*this_).classifier) );
      15           0 :     (*this_).feature_count = 0;
      16           0 :     (*this_).relationship_count = 0;
      17             : 
      18           0 :     U8_TRACE_END();
      19           0 : }
      20             : 
      21           0 : void data_node_set_destroy( data_node_set_t *this_ )
      22             : {
      23           0 :     U8_TRACE_BEGIN();
      24             : 
      25           0 :     data_classifier_destroy( &((*this_).classifier) );
      26           0 :     data_node_set_private_destroy_features( this_ );
      27           0 :     data_node_set_private_destroy_relationships( this_ );
      28             : 
      29           0 :     U8_TRACE_END();
      30           0 : }
      31             : 
      32           0 : u8_error_t data_node_set_load( data_node_set_t *this_, data_row_id_t classifier_id, data_database_reader_t *db_reader )
      33             : {
      34           0 :     U8_TRACE_BEGIN();
      35           0 :     assert( NULL != db_reader );
      36           0 :     u8_error_t result = U8_ERROR_NONE;
      37             : 
      38           0 :     if ( DATA_ROW_ID_VOID == classifier_id )
      39             :     {
      40             :         /* re-init */
      41           0 :         data_classifier_reinit_empty( &((*this_).classifier) );
      42             : 
      43           0 :         data_node_set_private_destroy_features( this_ );
      44           0 :         data_node_set_private_destroy_relationships( this_ );
      45             :     }
      46             :     else
      47             :     {
      48             :         u8_error_t db_err;
      49             : 
      50           0 :         data_classifier_destroy( &((*this_).classifier) );
      51           0 :         data_node_set_private_destroy_features( this_ );
      52           0 :         data_node_set_private_destroy_relationships( this_ );
      53             : 
      54             :         /* load classifier */
      55           0 :         db_err = data_database_reader_get_classifier_by_id ( db_reader, classifier_id, &((*this_).classifier) );
      56             : 
      57           0 :         if ( u8_error_contains(db_err, U8_ERROR_STRING_BUFFER_EXCEEDED ) )
      58             :         {
      59           0 :             U8_LOG_ERROR( "U8_ERROR_STRING_BUFFER_EXCEEDED at loading visible classifiers of a diagram" );
      60             :         }
      61           0 :         if ( u8_error_contains( db_err, U8_ERROR_ARRAY_BUFFER_EXCEEDED ) )
      62             :         {
      63           0 :             U8_LOG_ERROR( "U8_ERROR_ARRAY_BUFFER_EXCEEDED at loading visible classifiers of a diagram" );
      64             :         }
      65           0 :         if ( u8_error_more_than( db_err, U8_ERROR_STRING_BUFFER_EXCEEDED|U8_ERROR_ARRAY_BUFFER_EXCEEDED ) )
      66             :         {
      67             :             /* error at loading */
      68           0 :             data_classifier_reinit_empty( &((*this_).classifier) );
      69             :         }
      70           0 :         result |= db_err;  /* collect error flags */
      71             : 
      72             :         /* load features */
      73           0 :         db_err = data_database_reader_get_features_by_classifier_id ( db_reader,
      74             :                                                                       classifier_id,
      75             :                                                                       DATA_NODE_SET_MAX_FEATURES,
      76           0 :                                                                       &((*this_).features),
      77             :                                                                       &((*this_).feature_count)
      78             :                                                                     );
      79             : 
      80           0 :         if ( u8_error_contains( db_err, U8_ERROR_STRING_BUFFER_EXCEEDED ) )
      81             :         {
      82           0 :             U8_LOG_ERROR( "U8_ERROR_STRING_BUFFER_EXCEEDED at loading features of a diagram" );
      83             :         }
      84           0 :         if ( u8_error_contains( db_err, U8_ERROR_ARRAY_BUFFER_EXCEEDED ) )
      85             :         {
      86           0 :             U8_LOG_ERROR( "U8_ERROR_ARRAY_BUFFER_EXCEEDED at loading features of a diagram" );
      87             :         }
      88           0 :         if ( u8_error_more_than( db_err, U8_ERROR_STRING_BUFFER_EXCEEDED|U8_ERROR_ARRAY_BUFFER_EXCEEDED ) )
      89             :         {
      90             :             /* error at loading */
      91           0 :             (*this_).feature_count = 0;
      92             :         }
      93           0 :         result |= db_err;  /* collect error flags */
      94             : 
      95             :         /* load relationships */
      96           0 :         db_err = data_database_reader_get_relationships_by_classifier_id ( db_reader,
      97             :                                                                            classifier_id,
      98             :                                                                            DATA_NODE_SET_MAX_RELATIONSHIPS,
      99           0 :                                                                            &((*this_).relationships),
     100             :                                                                            &((*this_).relationship_count)
     101             :                                                                          );
     102             : 
     103           0 :         if ( u8_error_contains( db_err, U8_ERROR_STRING_BUFFER_EXCEEDED ) )
     104             :         {
     105           0 :             U8_LOG_ERROR( "U8_ERROR_STRING_BUFFER_EXCEEDED at loading relationships of a diagram" );
     106             :         }
     107           0 :         if ( u8_error_contains( db_err, U8_ERROR_ARRAY_BUFFER_EXCEEDED ) )
     108             :         {
     109           0 :             U8_LOG_ERROR( "U8_ERROR_ARRAY_BUFFER_EXCEEDED at loading relationships of a diagram" );
     110             :         }
     111           0 :         if ( u8_error_more_than( db_err, U8_ERROR_STRING_BUFFER_EXCEEDED|U8_ERROR_ARRAY_BUFFER_EXCEEDED ) )
     112             :         {
     113             :             /* error at loading */
     114           0 :             (*this_).relationship_count = 0;
     115             :         }
     116           0 :         result |= db_err;  /* collect error flags */
     117             :     }
     118             : 
     119           0 :     U8_TRACE_END_ERR(result);
     120           0 :     return result;
     121             : }
     122             : 
     123             : 
     124             : /*
     125             : Copyright 2020-2024 Andreas Warnke
     126             : 
     127             : Licensed under the Apache License, Version 2.0 (the "License");
     128             : you may not use this file except in compliance with the License.
     129             : You may obtain a copy of the License at
     130             : 
     131             :     http://www.apache.org/licenses/LICENSE-2.0
     132             : 
     133             : Unless required by applicable law or agreed to in writing, software
     134             : distributed under the License is distributed on an "AS IS" BASIS,
     135             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     136             : See the License for the specific language governing permissions and
     137             : limitations under the License.
     138             : */

Generated by: LCOV version 1.16