20 return (value ?
"yes" :
"no");
25 const std::string&
range,
29 const std::string& default_value,
30 const std::string& description)
50 return "8-bits signed integer";
52 return "8-bits unsigned integer";
54 return "16-bits signed integer";
56 return "16-bits unsigned integer";
58 return "32-bits signed integer";
60 return "32-bits unsigned integer";
62 return "64-bits signed integer";
64 return "64-bits unsigned integer";
78 return "class reference";
134 return "hexadecimal";
136 return "not applicable";
143 out << prefix <<
"attribute \'" <<
p_name <<
"\'\n"
145 << prefix <<
" range: \'" <<
p_range <<
"\'\n";
165 const std::string&
type,
169 const std::string& description)
185 switch (cardinality) {
187 return "zero or one";
189 return "zero or many";
193 return "one or many";
202 out << prefix <<
"relationship \'" <<
p_name <<
"\'\n"
203 << prefix <<
" class type: \'" <<
p_type <<
"\'\n"
217 const std::string& description,
218 const std::string& schema_path,
231 out << prefix <<
"class \'" <<
p_name <<
"\'\n"
237 out << prefix <<
" there are no superclasses\n";
241 out << prefix <<
" \'" << *i <<
"\'\n";
246 out << prefix <<
" there are no subclasses\n";
250 out << prefix <<
" \'" << *i <<
"\'\n";
254 std::string new_prefix(prefix);
258 out << prefix <<
" there are no attributes\n";
262 (*i).print(
out, new_prefix.c_str());
268 out << prefix <<
" there are no relationships\n";
272 (*i).print(
out, new_prefix.c_str());
300 std::cout <<
"Configuration implementation profiler report:\n"
301 " number of read objects: "
304 " number of cache hits: "
314 const std::string* class_name =
nullptr;
319 if (j != i->second->end()) {
321 TLOG_DEBUG(4) <<
"\n * found the object with id = \'" <<
id <<
"\' in class \'" << name <<
'\'';
325 class_name = i->first;
330 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << name
331 <<
"\' that has " << i->second->size() <<
" objects in cache: ";
332 for (j = i->second->begin(); j != i->second->end(); ++j) {
338 class_name = &DalFactory::instance().get_known_class_name_ref(name);
339 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << name
340 <<
"\' that has no objects in cache";
348 if (subclasses !=
m_conf->subclasses().end()) {
349 for (conffwk::fset::const_iterator k = subclasses->second.begin(); k != subclasses->second.end(); ++k) {
354 if (j != i->second->end()) {
356 TLOG_DEBUG(40) <<
" * found the object with id = \'" <<
id <<
"\' in class \'" << *k <<
'\'';
364 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << *k
365 <<
"\' that has " << i->second->size() <<
" objects in cache: ";
366 for (j = i->second->begin(); j != i->second->end(); ++j) {
372 TLOG_DEBUG(40) <<
" * there is no object with id = \'" <<
id <<
"\' found in the class \'" << *k
373 <<
"\' that has no objects in cache\n";
378 TLOG_DEBUG(40) <<
" * there is no object \'" <<
id <<
"\' in class \'" << name
379 <<
"\' and it's subclasses, returning NULL ...";
381 TLOG_DEBUG(40) <<
" * there is no object \'" <<
id <<
"\' in class \'" << name <<
"\', returning NULL ...";
395 (*i->second)[
id] =
obj;
396 obj->m_class_name = i->first;
399 obj->m_class_name = &DalFactory::instance().get_known_class_name_ref(name);
407 const std::string& old_id,
408 const std::string& new_id)
noexcept
415 if (j != i->second->end()) {
418 if (
obj !=
nullptr) {
425 TLOG_DEBUG(2) <<
"rename implementation " << (
void*)j->second <<
" of object \'" << old_id <<
'@' << *class_name
426 <<
"\' to \'" << new_id <<
'\'';
436 for (
auto& j : *i.second)
459 m_impl->m_conf->convert(value,
obj, attr_name);
465 m_impl->m_conf->convert(value,
obj, attr_name);
471 m_impl->m_conf->convert(value,
obj, attr_name);
477 m_impl->m_conf->convert(value,
obj, attr_name);
483 m_impl->m_conf->convert(value,
obj, attr_name);
489 m_impl->m_conf->convert(value,
obj, attr_name);
495 m_impl->m_conf->convert(value,
obj, attr_name);
501 m_impl->m_conf->convert(value,
obj, attr_name);
507 m_impl->m_conf->convert(value,
obj, attr_name);
513 m_impl->m_conf->convert(value,
obj, attr_name);
519 m_impl->m_conf->convert(value,
obj, attr_name);
525 m_impl->m_conf->convert(value,
obj, attr_name);
531 const std::string& )
noexcept
539 m_impl->m_conf->convert2(value,
obj, attr_name);
545 m_impl->m_conf->convert2(value,
obj, attr_name);
551 m_impl->m_conf->convert2(value,
obj, attr_name);
557 m_impl->m_conf->convert2(value,
obj, attr_name);
563 m_impl->m_conf->convert2(value,
obj, attr_name);
569 m_impl->m_conf->convert2(value,
obj, attr_name);
575 m_impl->m_conf->convert2(value,
obj, attr_name);
581 m_impl->m_conf->convert2(value,
obj, attr_name);
587 m_impl->m_conf->convert2(value,
obj, attr_name);
593 m_impl->m_conf->convert2(value,
obj, attr_name);
599 const std::string& attr_name)
noexcept
601 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
virtual void clear() noexcept
Virtual method to clean resources used by the implementation object.
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)
conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > m_impl_objects
cache of implementation objects (class-name::->object_id->implementation)
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
std::vector< ConfigObjectImpl * > m_tangled_objects
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.
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