Throw daq::config::Generic exception when read empty value of relationship with non-zero cardinality constraint. As a consequence user's code may skip check of returned pointer for 0 (null) value, when relationship's cardinality is 1:1 or 1:N, e.g.:
daq::core::Application a(...); // read application's program; cardinality of relationahip is 1:1 try { const daq::core::ComputerProgram * program = a.get_Program(); std::cout << "the program ID: " << program->UID() << std::endl; // do not check for null } catch(daq::config::Exception& ex) { std::cerr << "ERROR: bad data; program is not set " << ex << std::endl; } // read application's host; cardinality of relationahip is 0:1 const daq::core::Computer * host = a.get_RunsOn(); if(host) { std::cout << "the host ID: " << host->UID() << std::endl; } // check for null else { std::cerr << "ERROR: bad data; host of " << a.UID() << " is not set" << std::endl; }
BEGIN_HEADER_EPILOGUE // any code between top and bottom keywords // appears in С++ header after declaration of all methods END_HEADER_EPILOGUEBelow there is just a reminder, how to use prologues, e.g. to declare a type or to include header file, etc:
BEGIN_HEADER_PROLOGUE // any code between top and bottom keywords appears before declaration of any methods // e.g. to include user's header put this: #include "my-package/my-header.h" END_HEADER_PROLOGUE