24#include <shared_mutex>
28#include <boost/pool/pool_alloc.hpp>
61 static std::string
fill(
const OksClass& c,
const std::string& name)
noexcept;
97 static std::string
fill(
const OksClass& c,
const std::string&
what,
const std::string& reason)
noexcept;
117 static std::string
fill(
const OksClass& c,
const std::string& reason)
noexcept;
127 :
exception(
fill(c, oid, op, reason.what()), reason.level() + 1)
138 const std::string& oid,
140 const std::string& reason)
noexcept;
160 static std::string
fill(
const char* op,
const std::string& reason)
noexcept;
170 :
exception(
fill(query, c, reason.what()), reason.level() + 1)
196 static std::string
fill(
const std::string&
what,
const std::string& reason)
noexcept;
243 typedef std::set<OksClass*, SortByName>
Set;
249 bool operator()(
const char* c1,
const char* c2)
const {
return (strcmp(c1, c2) < 0); }
252 typedef std::map<const char*, OksClass*, SortStr>
Map;
254 typedef std::list<OksClass*, boost::fast_pool_allocator<OksClass*>>
FList;
279 const std::string& description,
282 bool transient =
false);
294 OksClass(
OksKernel* kernel,
const std::string& name,
const std::string& description,
bool is_abstract);
828 return (it !=
p_data_info->end() ? it->second :
nullptr);
927 inline OksClass(
const char* name,
size_t len);
966 return ((
this == &c ||
p_name == c.p_name) ?
true :
false);
static std::string fill(const OksAttribute &a, const OksObject *o, const std::string &reason) noexcept
AttributeConversionFailed(const OksAttribute &a, const OksObject *o, const exception &reason) noexcept
virtual ~AttributeConversionFailed() noexcept
BadReqExp(const std::string &what, const std::string &reason) noexcept
virtual ~BadReqExp() noexcept
static std::string fill(const std::string &what, const std::string &reason) noexcept
CannotDestroyClass(const OksClass &c, const exception &reason) noexcept
CannotDestroyClass(const OksClass &c, const std::string &reason) noexcept
static std::string fill(const OksClass &c, const std::string &reason) noexcept
virtual ~CannotDestroyClass() noexcept
static std::string fill(const OksClass &c, const std::string &name) noexcept
virtual ~CannotFindSuperClass() noexcept
CannotFindSuperClass(const OksClass &c, const std::string &name) noexcept
virtual ~CannotRegisterClass() noexcept
static std::string fill(const OksClass &c, const std::string &what, const std::string &reason) noexcept
CannotRegisterClass(const OksClass &c, const std::string &what, const std::string &reason) noexcept
CannotRegisterClass(const OksClass &c, const std::string &what, const exception &reason) noexcept
static std::string fill(const OksClass &c, const std::string &oid, const char *op, const std::string &reason) noexcept
ObjectOperationFailed(const OksClass &c, const std::string &oid, const char *op, const std::string &reason) noexcept
ObjectOperationFailed(const OksClass &c, const std::string &oid, const char *op, const exception &reason) noexcept
virtual ~ObjectOperationFailed() noexcept
void create_super_classes()
std::list< std::string * > * p_super_classes
void(*) NotifyFN(OksClass *)
bool get_is_abstract() const noexcept
const OksObject::Map * objects() const noexcept
OksDataInfo * get_data_info(const std::string &s) const noexcept
Get OKS data information for attribute or relationship.
std::set< OksClass *, SortByName > Set
const FList * all_sub_classes() const noexcept
OksRelationship * find_direct_relationship(const std::string &name) const noexcept
Find direct relationship.
bool operator==(const OksClass &) const
The equality operator.
void create_relationships()
size_t number_of_objects() const noexcept
void set_file(OksFile *f, bool update_owner=true)
Move class to different file.
bool check_relationships(std::ostringstream &out, bool print_file_name) const noexcept
OksObject::Map * p_objects
static const char superclass_xml_attr[]
OksClass * find_super_class(const std::string &) const noexcept
std::list< OksClass *, boost::fast_pool_allocator< OksClass * > > FList
OksAttribute * find_direct_attribute(const std::string &name) const noexcept
Find direct attribute.
void add_super_class(const std::string &name)
size_t number_of_direct_attributes() const noexcept
friend class OksAttribute
static void destroy_list(T list)
OksMethod * find_method(const std::string &name) const noexcept
Find method (search in this and base classes).
size_t number_of_direct_relationships() const noexcept
const std::list< OksMethod * > * all_methods() const noexcept
void registrate_class(bool skip_registered)
size_t number_of_direct_methods() const noexcept
FList * p_all_sub_classes
const std::list< OksAttribute * > * all_attributes() const noexcept
OksObject * get_object(const std::string *id) const noexcept
void registrate_instances()
static NotifyFN create_notify_fn
std::list< OksAttribute * > * p_all_attributes
static void destroy_map(T map)
void add_super_classes(FList *) const
friend class OksSortedClass
std::string p_description
static const char class_xml_tag[]
std::list< OksMethod * > * p_all_methods
size_t number_of_all_methods() const noexcept
size_t number_of_all_relationships() const noexcept
bool operator!=(const OksClass &) const
The not equal operator.
OksRelationship * find_relationship(const std::string &name) const noexcept
Find relationship (search in this and base classes).
std::mutex p_unique_id_mutex
friend class OksRelationship
static const char description_xml_attr[]
void swap(const OksAttribute *a1, const OksAttribute *a2)
Swap order of two attributes.
void registrate_class_change(ChangeType, const void *, bool=true)
void add(OksAttribute *a)
Add attribute.
void swap_super_classes(const std::string &c1, const std::string &c2)
Swap order of two superclasses.
void registrate_relationship_change(OksRelationship *)
OksKernel * get_kernel() const noexcept
void save(OksXmlOutputStream &) const
void set_is_abstract(bool abstract)
Set class abstract property.
OksIndex::Map * p_indices
void(*) ChangeNotifyFN(OksClass *, ChangeType, const void *)
static NotifyFN delete_notify_fn
static const char is_abstract_xml_attr[]
void remove_super_class(const std::string &name)
const std::string & get_name() const noexcept
OksAttribute * find_attribute(const std::string &name) const noexcept
Find attribute (search in this and base classes).
std::list< OksRelationship * > * p_relationships
const FList * all_super_classes() const noexcept
const std::list< OksRelationship * > * direct_relationships() const noexcept
size_t number_of_all_attributes() const noexcept
void remove(const OksAttribute *a)
Remove attribute.
static ChangeNotifyFN change_notify_fn
friend class OksMethodImplementation
void set_description(const std::string &description)
Set class description.
std::shared_mutex p_mutex
OksClass * source_class(const OksAttribute *a) const noexcept
Get class owning given attribute.
const std::string & get_description() const noexcept
static const char name_xml_attr[]
bool compare_without_methods(const OksClass &c) const noexcept
OksClass(const std::string &name, OksKernel *kernel, bool transient=false)
Create OKS class.
std::vector< OksClass * > * p_inheritance_hierarchy
const std::list< OksMethod * > * direct_methods() const noexcept
std::list< OksAttribute * > * p_attributes
OksObject * get_object(const std::string &id) const noexcept
Get object by ID.
OksDataInfo * data_info(const std::string &s) const noexcept
Get OKS data information for attribute or relationship.
void k_add(OksAttribute *a)
Kernel method to add attribute.
void registrate_attribute_change(OksAttribute *)
std::list< OksMethod * > * p_methods
std::list< OksObject * > * create_list_of_all_objects() const noexcept
Get all objects of the class (including derived).
OksDataInfo::Map * p_data_info
const std::list< OksAttribute * > * direct_attributes() const noexcept
void lock_file(const char *)
OksFile * get_file() const noexcept
OksObject::List * execute_query(OksQuery *query) const
Execute query.
const std::list< std::string * > * direct_super_classes() const noexcept
void k_add_super_class(const std::string &name)
static void destroy(OksClass *c)
Destroy OKS class.
std::list< OksRelationship * > * p_all_relationships
OksMethod * find_direct_method(const std::string &name) const noexcept
Find direct method.
ChangeType
Information about class property changes.
@ ChangeRelationshipComposite
@ ChangeAttributeDescription
@ ChangeRelationshipHighCC
@ ChangeRelationshipLowCC
@ ChangeAttributeIsNoNull
@ ChangeAttributeInitValue
@ ChangeRelationshipClassType
@ ChangeRelationshipDescription
@ ChangeMethodDescription
@ ChangeRelationshipExclusive
@ ChangeRelationshipDependent
@ ChangeAttributeMultiValueCardinality
@ ChangeRelationshipsList
@ ChangeMethodImplementation
friend std::ostream & operator<<(std::ostream &, const OksClass &)
Stream operator.
std::map< const char *, OksClass *, SortStr > Map
bool has_direct_super_class(const std::string &) const noexcept
const std::list< OksRelationship * > * all_relationships() const noexcept
FList * p_all_super_classes
void create_sub_classes()
Provides interface to the OKS XML schema and data files.
std::map< const OksAttribute *, OksIndex *, SortByName > Map
Provides interface to the OKS kernel.
OksObject describes instance of OksClass.
std::list< OksObject * > List
std::unordered_map< const std::string *, OksObject *, oks::hash_str, oks::equal_str > Map
OKS query expression class.
static std::string fill(const OksQueryExpression &query, const OksClass &c, const std::string &reason) noexcept
QueryFailed(const OksQueryExpression &query, const OksClass &c, const exception &reason) noexcept
virtual ~QueryFailed() noexcept
QueryFailed(const OksQueryExpression &query, const OksClass &c, const std::string &reason) noexcept
virtual ~SetOperationFailed() noexcept
SetOperationFailed(const char *op, const exception &reason) noexcept
static std::string fill(const char *op, const std::string &reason) noexcept
SetOperationFailed(const char *op, const std::string &reason) noexcept
virtual const char * what() const noexcept
exception(const std::string &what_arg, int level_arg) noexcept
FELIX Initialization std::string initerror FELIX queue timed out
bool operator()(OksClass *c1, OksClass *c2) const
bool operator()(const char *c1, const char *c2) const
Struct OKS data information.
std::map< std::string, OksDataInfo * > Map
Declare map of pointers to OksDataInfo (unsorted by name).