17 const char *
bool2str(
bool value) {
return (value ?
"yes" :
"no"); }
21 int_format_t int_format,
bool is_not_null,
bool is_multi_value,
22 const std::string& default_value,
const std::string& description
38 case s8_type:
return "8-bits signed integer";
39 case u8_type:
return "8-bits unsigned integer";
40 case s16_type:
return "16-bits signed integer";
41 case u16_type:
return "16-bits unsigned integer";
42 case s32_type:
return "32-bits signed integer";
43 case u32_type:
return "32-bits unsigned integer";
44 case s64_type:
return "64-bits signed integer";
45 case u64_type:
return "64-bits unsigned integer";
53 default:
return "unknown";
76 default:
return "unknown";
86 default:
return "not applicable";
93 << prefix <<
"attribute \'" <<
p_name <<
"\'\n"
95 << prefix <<
" range: \'" <<
p_range <<
"\'\n";
116 const std::string& name,
const std::string&
type,
bool can_be_null,
117 bool is_multi_value,
bool is_aggregation,
const std::string& description
133 switch(cardinality) {
138 default:
return "unknown";
145 << prefix <<
"relationship \'" <<
p_name <<
"\'\n"
146 << prefix <<
" class type: \'" <<
p_type <<
"\'\n"
159 const std::string& name,
160 const std::string& description,
161 const std::string& schema_path,
173 << prefix <<
"class \'" <<
p_name <<
"\'\n"
179 out << prefix <<
" there are no superclasses\n";
184 out << prefix <<
" \'" << *i <<
"\'\n";
189 out << prefix <<
" there are no subclasses\n";
194 out << prefix <<
" \'" << *i <<
"\'\n";
198 std::string new_prefix(prefix);
202 out << prefix <<
" there are no attributes\n";
207 (*i).print(
out, new_prefix.c_str());
213 out << prefix <<
" there are no relationships\n";
218 (*i).print(
out, new_prefix.c_str());
247 "Configuration implementation profiler report:\n"
258 const std::string * class_name =
nullptr;
263 if(j != i->second->end()) {
265 TLOG_DEBUG(4) <<
"\n * found the object with id = \'" <<
id <<
"\' in class \'" << name <<
'\'' ;
269 class_name = i->first;
275 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << name
276 <<
"\' that has " << i->second->size() <<
" objects in cache: ";
277 for(j=i->second->begin(); j != i->second->end();++j) {
284 class_name = &DalFactory::instance().get_known_class_name_ref(name);
285 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << name
286 <<
"\' that has no objects in cache";
294 if(subclasses !=
m_conf->subclasses().end()) {
295 for(conffwk::fset::const_iterator k = subclasses->second.begin(); k != subclasses->second.end(); ++k) {
300 if(j != i->second->end()) {
302 TLOG_DEBUG(40) <<
" * found the object with id = \'" <<
id <<
"\' in class \'" << *k <<
'\'';
311 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << *k
312 <<
"\' that has " << i->second->size() <<
" objects in cache: ";
313 for(j=i->second->begin(); j != i->second->end();++j) {
321 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << *k
322 <<
"\' that has no objects in cache\n";
328 TLOG_DEBUG(40) <<
" * there is no object \'" <<
id <<
"\' in class \'" << name
329 <<
"\' and it's subclasses, returning NULL ...";
332 TLOG_DEBUG(40) <<
" * there is no object \'" <<
id <<
"\' in class \'" << name <<
"\', returning NULL ...";
347 (*i->second)[
id] =
obj;
348 obj->m_class_name = i->first;
352 obj->m_class_name = &DalFactory::instance().get_known_class_name_ref(name);
367 if (j != i->second->end())
379 TLOG_DEBUG(2) <<
"rename implementation " << (
void *)j->second <<
" of object \'" << old_id <<
'@' << *class_name <<
"\' to \'" << new_id <<
'\'';
390 for (
auto& j : *i.second)
407 return m_conf->m_impl_mutex;
413 m_impl->m_conf->convert(value,
obj, attr_name);
419 m_impl->m_conf->convert(value,
obj, attr_name);
425 m_impl->m_conf->convert(value,
obj, attr_name);
431 m_impl->m_conf->convert(value,
obj, attr_name);
437 m_impl->m_conf->convert(value,
obj, attr_name);
443 m_impl->m_conf->convert(value,
obj, attr_name);
449 m_impl->m_conf->convert(value,
obj, attr_name);
455 m_impl->m_conf->convert(value,
obj, attr_name);
461 m_impl->m_conf->convert(value,
obj, attr_name);
467 m_impl->m_conf->convert(value,
obj, attr_name);
473 m_impl->m_conf->convert(value,
obj, attr_name);
479 m_impl->m_conf->convert(value,
obj, attr_name);
492 m_impl->m_conf->convert2(value,
obj, attr_name);
498 m_impl->m_conf->convert2(value,
obj, attr_name);
504 m_impl->m_conf->convert2(value,
obj, attr_name);
510 m_impl->m_conf->convert2(value,
obj, attr_name);
516 m_impl->m_conf->convert2(value,
obj, attr_name);
522 m_impl->m_conf->convert2(value,
obj, attr_name);
528 m_impl->m_conf->convert2(value,
obj, attr_name);
534 m_impl->m_conf->convert2(value,
obj, attr_name);
540 m_impl->m_conf->convert2(value,
obj, attr_name);
546 m_impl->m_conf->convert2(value,
obj, attr_name);
552 m_impl->m_conf->convert2(value,
obj, attr_name);
Implements database objects.
friend class ConfigObject
void convert(bool &value, const ConfigObject &obj, const std::string &attr_name) noexcept
ConfigurationImpl * m_impl
void put_impl_object(const std::string &class_name, const std::string &id, ConfigObjectImpl *obj) noexcept
put object to cache
ConfigurationImpl() noexcept
The constructor.
void clean() noexcept
clean cache (e.g. to be used by destructor)
std::vector< ConfigObjectImpl * > m_tangled_objects
ConfigObjectImpl * get_impl_object(const std::string &class_name, const std::string &id) const noexcept
get object from cache
virtual ~ConfigurationImpl()
Virtual destructor.
void rename_impl_object(const std::string *class_name, const std::string &old_id, const std::string &new_id) noexcept
rename object in cache
friend class ConfigObjectImpl
unsigned long p_number_of_cache_hits
void print_cache_info() noexcept
Print profiling information about objects in cache.
Configuration * m_conf
Configuration pointer is needed for notification on changes, e.g. in case of subscription or an objec...
std::mutex & get_conf_impl_mutex() const
Is required by reload methods.
conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > m_impl_objects
cache of implementation objects (class-name::->object_id->implementation)
unsigned long p_number_of_object_read
#define TLOG_DEBUG(lvl,...)
const char * bool2str(bool value)
std::ostream & operator<<(std::ostream &, const ConfigurationChange &)
DAC value out of range
Message.
FELIX Initialization std::string initerror FELIX queue timed out
int_format_t p_int_format
static const char * type(type_t type)
std::string p_description
void print(std::ostream &out, const std::string &prefix="") const
std::string p_default_value
static const char * type2str(type_t type)
static const char * format2str(int_format_t format)
const std::vector< attribute_t > p_attributes
const std::vector< relationship_t > p_relationships
void print(std::ostream &out, const std::string &prefix="") const
const std::vector< std::string > p_subclasses
std::string p_description
std::string p_schema_path
const std::vector< std::string > p_superclasses
cardinality_t p_cardinality
void print(std::ostream &out, const std::string &prefix="") const
static const char * card2str(cardinality_t cardinality)
std::string p_description