1 #ifndef _CONFIG_OBJECT_IMPL_H_ 2 #define _CONFIG_OBJECT_IMPL_H_ 8 if (
get_data_raw(&p_out,
sizeof(
T)) !=
sizeof(
T))
throw exception_io_data_truncation();
19 if (!
g_find(ptr,p_guid))
throw exception_service_not_found();
20 return ptr->get_data_struct_t<
T>(p_out);
26 if (!
g_find(ptr,p_guid))
throw exception_service_not_found();
27 return ptr->set_data_struct_t<
T>(p_in);
51 template<t_size p_size>
65 template<t_size p_size>
72 p_stream->write_object(m_data,p_size,p_abort);
80 p_stream->read_object(temp,p_size,p_abort);
82 memcpy(m_data,temp,p_size);
91 memcpy(m_data,p_data,p_size);
108 template<t_size p_size,
bool isConst = false>
128 template<
bool isConst = false>
136 template<
class T,
bool isConst = false>
173 #endif //_CONFIG_OBJECT_IMPL_H_
config_object_int_factory_t(const GUID &p_guid, T p_initval)
t_size get_watched_object_count()
void ensure_main_thread()
Triggers a bug check if the calling thread is not the main app thread.
static void g_on_changed(const service_ptr_t< config_object > &p_object)
config_object_fixed_const_impl_t(const GUID &p_guid, const void *p_data)
void get_data(stream_writer *p_stream, abort_callback &p_abort) const
void get_data_raw(stream_writer *p_stream, abort_callback &p_abort)
Retrieves state of the variable. Called only from main thread, when writing configuration file...
config_object_fixed_factory_t(const GUID &p_guid, const void *p_initval)
void order_native_to_le_t(T ¶m)
void set_data(stream_reader *p_stream, abort_callback &p_abort, bool p_notify)
void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
Sets state of the variable. Called only from main thread, when reading configuration file...
virtual void get_data(stream_writer *p_stream, abort_callback &p_abort) const =0
GUID get_watched_object(t_size p_index)
config_object_fixed_impl_t< p_size > type
config_object_fixed_impl_t(const GUID &p_guid, const void *p_data)
config_object_int_factory_t< t_int32 > config_object_int32_factory
void get_data_raw(stream_writer *p_stream, abort_callback &p_abort)
Retrieves state of the variable. Called only from main thread, when writing configuration file...
config_object_fixed_const_impl_t< p_size > type
t_size get_data_raw(void *p_out, t_size p_bytes)
t_size strlen_max(const char *ptr, t_size max)
config_object_bool_factory_t config_object_bool_factory
static void g_get_data_struct_t(const GUID &p_guid, T &p_out)
void on_watched_object_changed(const service_ptr_t< config_object > &p_object)
static void g_set_data_struct_t(const GUID &p_guid, const T &p_in)
service_factory_single_transparent_t< config_object_impl > config_object_factory
config_object_string_factory(const GUID &p_guid, const char *p_string, t_size p_string_length=~0)
void set_data(stream_reader *p_stream, abort_callback &p_abort, bool p_notify)
pfc::array_t< t_uint8 > m_data
void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
Sets state of the variable. Called only from main thread, when reading configuration file...
void get_data(stream_writer *p_stream, abort_callback &p_abort) const
service_factory_single_transparent_t< config_object_notify_impl_simple > config_object_notify_simple_factory
virtual void set_data(stream_reader *p_stream, abort_callback &p_abort, bool p_sendnotify=true)=0
Base class for configuration variable classes; provides self-registration mechaisms and methods to se...
config_object_notify_impl_simple(const GUID &p_guid, t_func p_func)
void set_data_struct_t(const T &p_in)
void get_data_struct_t(T &p_out)
config_object_bool_factory_t(const GUID &p_guid, bool p_initval)
void set_data_raw(const void *p_data, t_size p_bytes, bool p_sendnotify=true)
static bool g_find(service_ptr_t< config_object > &p_out, const GUID &p_guid)