60 : m_Converter(converter),
70 size_t dst_size = m_Converter->GetDstTypeSize();
71 for (
size_t i = GetElementCount();
i--; ) {
72 m_Converter->Destroy(
static_cast<char*
>(GetArrayPtr())+
i*dst_size);
87 TParamStaticArrayCopyWarning::GetDefault()) ) {
98 <<
": converting static array from "
110 for (
size_t i = 0;
i <
size; ++
i ) {
112 static_cast<const char*
>(src_array)+
i*src_size);
122 if ( TParamStaticArrayUnsafeTypeWarning::GetDefault() ) {
126 file? line: __LINE__,
133 <<
": static array type is not MT-safe: " <<
type_name <<
"[]";
149 file? line: __LINE__,
156 <<
"keys are out of order: "
157 <<
"key["<<curr_index<<
"] < key["<<(curr_index-1)<<
"]";
void Convert(const void *src_array, size_t size, const char *file, int line, ECopyWarn warn)
Convert data from static array of different type using the holder's converter.
CArrayHolder(IObjectConverter *converter) THROWS_NONE
void * GetArrayPtr(void) const
~CArrayHolder(void) THROWS_NONE
unique_ptr< IObjectConverter > m_Converter
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
Helper class for single object conversion from static type to work type.
virtual ~IObjectConverter(void) THROWS_NONE
#define NCBI_MAKE_MODULE(module)
Set default module name based on NCBI_MODULE macro.
#define NCBI_CURRENT_FUNCTION
Get current function name.
#define NCBI_ERRCODE_X_NAME(name)
Returns value of error code by its name defined by NCBI_DEFINE_ERRCODE_X.
const CNcbiDiag & GetRef(void) const
Some compilers (e.g.
@ eDPF_Default
Use global default flags (merge with).
@ eDPF_File
File name (not full path)
@ eDPF_LongFilename
Full file path.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
#define THROWS_NONE
Do not use 'throw' dynamic exception specification for C++11 compilers.
@ eParam_NoThread
Do not use per-thread values.
#define ErrCode()
Get the error code for the last failed system function.
const struct ncbi::grid::netcache::search::fields::SIZE size
NCBI_PARAM_DEF_EX(bool, NCBI, STATIC_ARRAY_COPY_WARNING, false, eParam_NoThread, NCBI_STATIC_ARRAY_COPY_WARNING)
void ReportUnsafeStaticType(const char *type_name, const char *file, int line)
Log error message about non-MT-safe static type (string, pair<>) if it's configured by TParamStaticAr...
DEFINE_CLASS_STATIC_FAST_MUTEX(IObjectConverter::sx_InitMutex)
END_NAMESPACE(NStaticArray)
void ReportIncorrectOrder(size_t curr_index, const char *file, int line)
Log error message about wrong order of elements in array and abort.
BEGIN_NAMESPACE(NStaticArray)
STATIC_ARRAY_COPY_WARNING
STATIC_ARRAY_UNSAFE_TYPE_WARNING
static const char * type_name(CS_INT value)