14 #ifndef DD_VALIDATIONINFOMODEL_H_INCLUDED
15 #define DD_VALIDATIONINFOMODEL_H_INCLUDED
24 #include <unordered_map>
25 #include <unordered_set>
28 #define DEV_ESSENTIAL_DEPRECATED_VALIDATION_API \
29 DEV_ESSENTIAL_DEPRECATED("Use the ddl::dd::DataDefinition::isValid() and " \
30 "ddl::dd::DataDefinition::getValidationProtocol() instead.")
88 DEV_ESSENTIAL_DEPRECATED_VALIDATION_API
110 const std::string& from,
111 const std::string& to);
213 const std::string& old_name,
223 const std::string& old_name,
233 const std::string& old_name,
243 const std::string& old_name,
253 const std::string& old_name,
263 const std::string& old_name,
273 const std::string& old_name,
283 const std::string& old_name,
296 typedef std::unordered_map<std::string, std::unordered_set<std::string>>
ToFromMap;
369 const std::shared_ptr<const ValidationProblem>& problem);
393 #if defined(__GNUC__) && ((__GNUC__ == 5) && (__GNUC_MINOR__ == 2))
394 #pragma GCC diagnostic push
395 #pragma GCC diagnostic ignored "-Wattributes"
400 std::unordered_map<ValidationProblemId, std::shared_ptr<const ValidationProblem>>>
401 _validation_problems;
403 #if defined(__GNUC__) && ((__GNUC__ == 5) && (__GNUC_MINOR__ == 2))
404 #pragma GCC diagnostic pop
407 bool _validation_needed =
true;
428 DEV_ESSENTIAL_DEPRECATED_VALIDATION_API
436 DEV_ESSENTIAL_DEPRECATED_VALIDATION_API
444 DEV_ESSENTIAL_DEPRECATED_VALIDATION_API
452 DEV_ESSENTIAL_DEPRECATED_VALIDATION_API
460 DEV_ESSENTIAL_DEPRECATED_VALIDATION_API
609 bool _currently_on_validation =
false;
611 void addProblem(
const std::shared_ptr<ValidationServiceInfo::ValidationProblem>& problem);
614 std::shared_ptr<ValidationServiceInfo::ValidationProblem>>>
615 _validation_problems;
617 bool _is_validated =
false;
Validation Info model will check for validation.
UpdateType
Update type for the struct update.
@ only_last
update the last element only
@ all
update all elements validation info
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo(datamodel::EnumType &enum_type, datamodel::DataDefinition &parent_dd)
CTOR and immediatelly update a Validation Info for enum_type.
ValidationLevel getValidationLevel() const
Get the Validation Level.
virtual ~ValidationInfo()
DTOR.
void removeProblems(datamodel::DataDefinition &parent_dd)
Remove all problems.
bool isValid(ValidationLevel level=ValidationLevel::valid) const
checks if the validation level is reached
void addProblem(ValidationServiceInfo::ValidationProblem &&problem)
adds a problem
static constexpr const uint8_t INFO_TYPE_ID
the type info id to use the datamodel::Info template.
void forceRevalidation()
sets the Info to invalid to force revalidation
void update(datamodel::StructType &struct_type, datamodel::DataDefinition &parent_dd, UpdateType update_type=UpdateType::all)
Update and revalidate the struct_type.
std::vector< Problem > getProblems() const
Get the Validation Problems (only set if below "valid")
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo(datamodel::DataType &data_type, datamodel::DataDefinition &parent_dd)
CTOR and immediatelly update a Validation Info for data_types.
void update(datamodel::Stream &stream, datamodel::DataDefinition &parent_dd)
Update and revalidate the stream.
void update(datamodel::StreamMetaType &stream_meta_type, datamodel::DataDefinition &parent_dd)
Update and revalidate the stream_meta_type.
void addProblem(const ValidationServiceInfo::ValidationProblem &problem)
adds a problem
void update(datamodel::DataType &data_type, datamodel::DataDefinition &parent_dd)
Update and revalidate the data_type.
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.
ValidationLevel
Validation level.
@ valid
every thing is well defined.
@ good_enough
Structs and elements can be "good_enough" for the TypeInfo.
@ invalid
the validation level is invalid, dependencies can not be obtained or the dependency "to" is invalid (...
@ dont_know
The validation is not known.
void update(datamodel::Unit &unit, datamodel::DataDefinition &parent_dd)
Update and revalidate the unit.
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationInfo(datamodel::Stream &stream, datamodel::DataDefinition &parent_dd)
CTOR and immediatelly update a Validation Info for streams.
void update(datamodel::EnumType &enum_type, datamodel::DataDefinition &parent_dd)
Update and revalidate the enum_type.
ValidationLevel getLevel() const
Get the Level.
ValidationProblem(const ddl::dd::Problem &problem)
CTOR which sets the level to ValidationLevel::invalid.
ValidationProblem()=default
CTOR.
ValidationProblem(ValidationLevel level, const ddl::dd::Problem &problem)
CTOR.
ddl::dd::Problem getProblem() const
Get the Problem.
Validation Service Info used only as one global instance at the dd::DataDefinition.
void renamed(const datamodel::Stream &stream, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed stream.
ValidationLevel getValidationLevel() const
Get the current Validation Level.
std::unordered_map< uint8_t, ToFromMap > _dependencies
dependencies are stored in ToFrom maps (not in FromTo maps)
DependencyType
dependency type for loose coupling
@ struct_type_to_unit
dependency struct type depends on a unit, if one element belongs to it
@ struct_type_to_enum_type
dependency struct type depends on a enum type
@ data_type_to_unit
dependency data type depends on a unit
@ data_type_to_base_unit
dependency data type depends on a base unit
@ stream_meta_type_to_stream_meta_type
dependency stream_meta_type depends on a stream_meta_type
@ struct_type_to_data_type
dependency struct type depends on a data type
@ unit_to_base_unit
dependency unit depends on a base unit
@ stream_to_stream_meta_type
dependency stream depends on a stream_meta_type
@ struct_type_to_struct_type
dependency struct type depends on a struct type
@ enum_type_to_data_type
dependency enum type depends on a data type
@ struct_type_to_base_unit
dependency struct type depends on a base unit, if one element belongs to it
@ stream_to_struct_type
dependency stream depends on a struct_type
@ unit_to_unit_prefix
dependency unit depends on a unit prefix
void removed(const datamodel::StreamMetaType &stream_meta_type, datamodel::DataDefinition &parent_dd)
A stream_meta_type was removed.
void renamed(const datamodel::UnitPrefix &unit_prefix, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed unit_prefix.
void removed(const datamodel::EnumType &enum_type, datamodel::DataDefinition &parent_dd)
A enum_type was removed.
void forceRevalidationOfTypeDependencies(const std::string &type_name, ddl::dd::TypeOfType type, datamodel::DataDefinition &parent_dd, InvalidatedTypes &invalidated_types_to_return) const
Collect all dependent types to the given one and sets them invalid.
std::unordered_map< std::string, std::unordered_set< std::string > > ToFromMap
dependencies are stored in ToFrom maps (not in FromTo maps) to raise performance.
static constexpr const uint8_t INFO_TYPE_ID
definiton of info type to use the datamodel::Info
void renamed(const datamodel::BaseUnit &base_unit, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed base_unit.
void renamed(const datamodel::Unit &unit, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed unit.
void renamed(const datamodel::DataType &data_type, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed data_type.
DEV_ESSENTIAL_DEPRECATED_VALIDATION_API ValidationServiceInfo()=default
default CTOR
void removed(const datamodel::BaseUnit &base_unit, datamodel::DataDefinition &parent_dd)
A base unit was removed.
std::vector< Problem > getProblems() const
Get all current known problems of validation.
void removed(const datamodel::UnitPrefix &unit_prefix, datamodel::DataDefinition &parent_dd)
A unit prefix was removed.
void renamed(const datamodel::EnumType &enum_type, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed enum_type.
void addDependency(const Dependency &dependency)
add the dependency to the depemndency model
void removed(const datamodel::Unit &unit, datamodel::DataDefinition &parent_dd)
A unit was removed.
void renamed(const datamodel::StreamMetaType &stream_meta_type, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed base_stream_meta_typeunit.
void removed(const datamodel::Stream &stream, datamodel::DataDefinition &parent_dd)
A stream was removed.
void renamed(const datamodel::StructType &struct_type, const std::string &old_name, datamodel::DataDefinition &parent_dd)
Update all dependency to the renamed struct_type.
void removeProblem(ValidationProblemId id, ValidationLevel level)
Removes a validation propbelm entry by id and level.
void * ValidationProblemId
Id to identify a concrete validation problem entry.
void updateProblem(ValidationProblemId id, const std::shared_ptr< const ValidationProblem > &problem)
updates or add a problem entry by id
void removed(const datamodel::DataType &data_type, datamodel::DataDefinition &parent_dd)
A data_type was removed.
void removed(const datamodel::StructType &struct_type, datamodel::DataDefinition &parent_dd)
A struct_type was removed.
bool validationNeeded() const
this will internally prevent multiple revalidations
DataDefinition Datamodel This datamodel is observable for any change of:
observable DataDefinition object class to describe (POD) DataType.
observable DataDefinition object class to describe EnumType.
Helper template class to create valid IInfo objects.
observable Stream DataDefinition object.
observable DataDefinition object class to describe StructType.
Unit Prefix - datamodel pefixes.
OO DataDefinition Redesign.
OO DataDefinition Redesign.
OO DataDefinition info model types.
Definition of preprocessor macro DEV_ESSENTIAL_DEPRECATED.
TypeOfType
Classification of a Type.
@ enum_type
the type is a enum type (EnumType)
@ data_type
the type is a data type (DataType)
@ struct_type
the type is a struct type (StructType)
@ stream_meta_type
the type is an stream meta type (StreamMetaType)
@ unit
the unit is a unit (Unit)
@ base_unit
the unit is a base unit (BaseUnit)
ValidationLevel
Validation level.
@ valid
every thing is well defined.
@ validation_info
Validation Info.
@ validation_service_info
Validation Info Service.
definition of the ddl namespace
Problem to report to find the corresponding item name in a simple way.
std::string _from
the "from" item name.
Dependency()=delete
no default CTOR
~Dependency()=default
DTOR.
DependencyType _type_of_dependency
Dependency type.
Dependency(DependencyType type_of_dependency, const std::string &from, const std::string &to)
CTOR.
std::string _to
the "to" item name.
Return structure for forceRevalidationOfTypeDependencies call.
std::vector< std::string > _enum_type_names
Collection of enum type names that are invalidated.
std::vector< std::string > _struct_type_names
Collection of struct type names that are invalidated.