ADTF  3.18.2
ValidationInfo

Validation Info model will check for validation. More...

Inheritance diagram for ValidationInfo:
[legend]

Public Types

enum  ValidationLevel : uint8_t { dont_know , invalid , good_enough , valid }
 Validation level. More...
 
enum class  UpdateType { all = 0 , only_last = 1 }
 Update type for the struct update. More...
 
using Problem = ddl::dd::Problem
 Validation Problem to report.
 

Public Member Functions

DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo ()=default
 default CTOR
 
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo (datamodel::Unit &unit, datamodel::DataDefinition &parent_dd)
 CTOR and immediatelly update a Validation Info for units. More...
 
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo (datamodel::DataType &data_type, datamodel::DataDefinition &parent_dd)
 CTOR and immediatelly update a Validation Info for data_types. More...
 
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo (datamodel::EnumType &enum_type, datamodel::DataDefinition &parent_dd)
 CTOR and immediatelly update a Validation Info for enum_type. More...
 
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo (datamodel::Stream &stream, datamodel::DataDefinition &parent_dd)
 CTOR and immediatelly update a Validation Info for streams. More...
 
virtual ~ValidationInfo ()
 DTOR.
 
bool isValid (ValidationLevel level=ValidationLevel::valid) const
 checks if the validation level is reached More...
 
void forceRevalidation ()
 sets the Info to invalid to force revalidation
 
ValidationLevel getValidationLevel () const
 Get the Validation Level. More...
 
std::vector< ProblemgetProblems () const
 Get the Validation Problems (only set if below "valid") More...
 
void addProblem (ValidationServiceInfo::ValidationProblem &&problem)
 adds a problem More...
 
void addProblem (const ValidationServiceInfo::ValidationProblem &problem)
 adds a problem More...
 
void removeProblems (datamodel::DataDefinition &parent_dd)
 Remove all problems.
 
void update (datamodel::Unit &unit, datamodel::DataDefinition &parent_dd)
 Update and revalidate the unit. More...
 
void update (datamodel::DataType &data_type, datamodel::DataDefinition &parent_dd)
 Update and revalidate the data_type. More...
 
void update (datamodel::EnumType &enum_type, datamodel::DataDefinition &parent_dd)
 Update and revalidate the enum_type. More...
 
void update (datamodel::StructType &struct_type, datamodel::DataDefinition &parent_dd, UpdateType update_type=UpdateType::all)
 Update and revalidate the struct_type. More...
 
void update (datamodel::StreamMetaType &stream_meta_type, datamodel::DataDefinition &parent_dd)
 Update and revalidate the stream_meta_type. More...
 
void update (datamodel::Stream &stream, datamodel::DataDefinition &parent_dd)
 Update and revalidate the stream. More...
 
- Public Member Functions inherited from IInfo
virtual ~IInfo ()=default
 virtual DTOR for IInfo object
 

Static Public Attributes

static constexpr const uint8_t INFO_TYPE_ID = dd::InfoType::validation_info
 the type info id to use the datamodel::Info template.
 

Private Member Functions

void addProblem (const std::shared_ptr< ValidationServiceInfo::ValidationProblem > &problem)
 

Private Attributes

bool _currently_on_validation = false
 
std::map< uint8_t, std::unordered_map< ValidationServiceInfo::ValidationProblemId, std::shared_ptr< ValidationServiceInfo::ValidationProblem > > > _validation_problems
 
ValidationServiceInfo_current_validation_service = {}
 
bool _is_validated = false
 

Additional Inherited Members

- Protected Member Functions inherited from Info< ValidationInfo >
uint8_t getInfoType () const override
 Get the Info Type object. More...
 

Detailed Description

Validation Info model will check for validation.

Sometimes the TypeInfo must be already set before this validation can be performed.

Remarks
: This internal API is part of the internal infomodel of the ddl::DataDefinition class for Validation. It must not be used by you directly while it is not part of the binary compatibility promise! @dev_essential_deprecated Use ddl::dd::DataDefinition::isValid() and ddl::dd::DataDefinition::getValidationProtocol() instead.

Definition at line 420 of file dd_validationinfomodel.h.

Member Enumeration Documentation

◆ UpdateType

enum UpdateType
strong

Update type for the struct update.

Enumerator
all 

update all elements validation info

only_last 

update the last element only

Definition at line 579 of file dd_validationinfomodel.h.

◆ ValidationLevel

enum ValidationLevel : uint8_t

Validation level.

This is used now used only for binary compatibility here.

Enumerator
dont_know 

The validation is not known.

This means it is not calculated yet. Use i.e. ddl::dd::DataDefinition::validate

invalid 

the validation level is invalid, dependencies can not be obtained or the dependency "to" is invalid (struct to struct i.e.).

good_enough 

Structs and elements can be "good_enough" for the TypeInfo.

This means the Coder and Decoder can calculate the sizes and the all access Functions can obtain values. Usually this should be the valid state. The problem is, that there are DataDefinition out there (in the users world) using i.e. units, but does not define the unit within that DD. At this point we do not want to break that code! So good enough means: Not well defined in some cases, but good enough for calculate byte positions and TypeInfo.

Only structs, enums and datatypes may have a validationlevel of "good_enough" if there are any other DD Objects used in a DataDefinition and they are "invalid", the DD will also set to "invalid"!

valid 

every thing is well defined.

Definition at line 471 of file dd_validationinfomodel.h.

Constructor & Destructor Documentation

◆ ValidationInfo() [1/4]

DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo ( datamodel::Unit unit,
datamodel::DataDefinition parent_dd 
)

CTOR and immediatelly update a Validation Info for units.

Parameters
unitthe unit to update the validation info
parent_ddthe parent DD to retrieve dependencies

◆ ValidationInfo() [2/4]

DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo ( datamodel::DataType data_type,
datamodel::DataDefinition parent_dd 
)

CTOR and immediatelly update a Validation Info for data_types.

Parameters
data_typethe data_type to update the validation info
parent_ddthe parent DD to retrieve dependencies

◆ ValidationInfo() [3/4]

DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo ( datamodel::EnumType enum_type,
datamodel::DataDefinition parent_dd 
)

CTOR and immediatelly update a Validation Info for enum_type.

Parameters
enum_typethe enum_type to update the validation info
parent_ddthe parent DD to retrieve dependencies

◆ ValidationInfo() [4/4]

DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo ( datamodel::Stream stream,
datamodel::DataDefinition parent_dd 
)

CTOR and immediatelly update a Validation Info for streams.

Parameters
streamthe stream to update the validation info
parent_ddthe parent DD to retrieve dependencies

Member Function Documentation

◆ addProblem() [1/2]

void addProblem ( const ValidationServiceInfo::ValidationProblem problem)

adds a problem

Parameters
problemthe prpblem to add

◆ addProblem() [2/2]

void addProblem ( ValidationServiceInfo::ValidationProblem &&  problem)

adds a problem

Parameters
problemthe problem to add

◆ getProblems()

std::vector<Problem> getProblems ( ) const

Get the Validation Problems (only set if below "valid")

Returns
std::vector<Problem>

◆ getValidationLevel()

ValidationLevel getValidationLevel ( ) const

Get the Validation Level.

Returns
ValidationLevel

◆ isValid()

bool isValid ( ValidationLevel  level = ValidationLevel::valid) const

checks if the validation level is reached

Parameters
levelcan only be "good_enough" or "valid"
Returns
true the given level is reached
false the given level is NOT reached

◆ update() [1/6]

void update ( datamodel::DataType data_type,
datamodel::DataDefinition parent_dd 
)

Update and revalidate the data_type.

Parameters
data_typethe unit to validate
parent_ddthe parent DD

◆ update() [2/6]

void update ( datamodel::EnumType enum_type,
datamodel::DataDefinition parent_dd 
)

Update and revalidate the enum_type.

Parameters
enum_typethe unit to validate
parent_ddthe parent DD

◆ update() [3/6]

void update ( datamodel::Stream stream,
datamodel::DataDefinition parent_dd 
)

Update and revalidate the stream.

Parameters
streamthe stream to validate
parent_ddthe parent DD

◆ update() [4/6]

void update ( datamodel::StreamMetaType stream_meta_type,
datamodel::DataDefinition parent_dd 
)

Update and revalidate the stream_meta_type.

Parameters
stream_meta_typethe stream_meta_type to validate
parent_ddthe parent DD

◆ update() [5/6]

void update ( datamodel::StructType struct_type,
datamodel::DataDefinition parent_dd,
UpdateType  update_type = UpdateType::all 
)

Update and revalidate the struct_type.

Parameters
struct_typethe struct_type to validate
parent_ddthe parent DD
update_typeupdate type to determine to validate only the last added element or all

◆ update() [6/6]

void update ( datamodel::Unit unit,
datamodel::DataDefinition parent_dd 
)

Update and revalidate the unit.

Parameters
unitthe unit to validate
parent_ddthe parent DD