Go to the documentation of this file. 1 #ifndef _OME_BASE_TYPE_H_
2 #define _OME_BASE_TYPE_H_ "$Id: OMEbaseType.h 312 2020-03-21 21:25:35Z geoff $"
16 #define FORCE_OME_EXTENDED_TYPE 0
18 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
19 #define OME_EXT_TYPE(member) value.extType->extValue. member
21 #define OME_EXT_TYPE(member) value. member
24 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
115 if (targetType == srcType)
135 bool isSigned =
false;
188 if (isSigned ==
true) {
195 if (isSigned ==
false) {
214 if (isSigned ==
true) {
219 if (isSigned ==
false) {
228 if (isSigned ==
false) {
279 static OMEbaseType *decode(
const class OMEstring *data,
size_t *offset,
280 const uint32_t version = 0);
288 #if (FORCE_OME_EXTENDED_TYPE == 0) && (__SIZEOF_POINTER__ == 8)
307 void freeComplexData();
332 OMEbaseType(
const OMEbaseType &org) {
344 explicit OMEbaseType(int32_t arg)
350 explicit OMEbaseType(uint32_t arg)
356 explicit OMEbaseType(uint16_t arg)
362 explicit OMEbaseType(uint8_t arg)
368 explicit OMEbaseType(
float arg)
374 explicit OMEbaseType(uint64_t arg)
377 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
384 explicit OMEbaseType(int64_t arg)
387 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
394 explicit OMEbaseType(
double arg)
397 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
451 void initializeAsType(
const enum OMEtypes_t t);
468 template <
typename TO_TYPE> TO_TYPE convertToNumericType()
const;
471 explicit operator int32_t()
const;
473 explicit operator uint32_t()
const;
475 explicit operator int64_t()
const;
477 explicit operator uint64_t()
const;
479 explicit operator float()
const;
481 explicit operator double()
const;
483 explicit operator const char *()
const {
486 return ((
const char *) (*value.s));
488 return (
"[NOTSTRING]");
497 value.i =
static_cast<int32_t
>(i);
505 value.ui =
static_cast<uint32_t
>(i);
538 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
549 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
560 #if (FORCE_OME_EXTENDED_TYPE == 1) || (__SIZEOF_POINTER__ < 8)
580 value.s =
new OMEstring(((
const unsigned char *) &c), 1);
638 value.oid =
new OMEoid(o);
698 value.nlm =
new OMEnlm(m);
783 # include <OMEtypeHdr1.genh>
787 # include <OMEtypeHdr2.genh>
798 uint64_t ui =
static_cast<uint64_t
>(i);
805 uint64_t ui =
static_cast<uint64_t
>(i);
812 uint64_t ui =
static_cast<uint64_t
>(i);
819 uint64_t ui =
static_cast<uint64_t
>(i);
820 OMEbaseType &result = (*this)[ui];
826 uint64_t ui =
static_cast<uint64_t
>(i);
827 OMEbaseType &result = (*this)[ui];
833 uint64_t ui =
static_cast<uint64_t
>(i);
834 OMEbaseType &result = (*this)[ui];
859 OMEbaseType &result = (*this)[
s];
867 OUTPUT_TYPENAME = (1 << 0),
868 DISABLE_QUOTE_OUTPUT = (1 << 1),
869 OUTPUT_NEWLINE = (1 << 2)
872 int_fast16_t indent = 0, uint8_t includeTypePrefix = OUTPUT_TYPENAME)
const;
876 return (OMEbaseType::typeName(type));
880 # ifndef DOXYGEN_ONLY
881 # define OMEtype OMEbaseType
884 template <
typename TO_TYPE>
inline TO_TYPE OMEbaseType::convertToNumericType()
const
890 result =
static_cast<TO_TYPE
>(value.i);
895 result =
static_cast<TO_TYPE
>(value.ui);
904 result =
static_cast<TO_TYPE
>(value.f);
910 result =
static_cast<TO_TYPE
>(0);
916 inline OMEbaseType::operator int32_t()
const
918 return (convertToNumericType<int32_t>());
921 inline OMEbaseType::operator uint32_t()
const
923 return (convertToNumericType<uint32_t>());
926 inline OMEbaseType::operator int64_t()
const
928 return (convertToNumericType<int64_t>());
931 inline OMEbaseType::operator uint64_t()
const
933 return (convertToNumericType<uint64_t>());
936 inline OMEbaseType::operator float()
const
938 return (convertToNumericType<float>());
941 inline OMEbaseType::operator double()
const
943 return (convertToNumericType<double>());
OME_FAST_CALL OMEtype & operator=(const OMEnlm &m)
Definition: OMEbaseType.h:695
@ DISSIMILAR_SIGN
signed vs. unsigned
Definition: OMEbaseType.h:65
#define OME_EXT_TYPE(member)
Definition: OMEbaseType.h:19
@ UNKNOWN_COMPATIBILITY
right side is ANY
Definition: OMEbaseType.h:69
static constexpr bool isInteger(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:105
@ OME_NLM
Definition: OMEmanifests.h:90
OME_FAST_CALL READ_ONLY_OMEtype operator[](const int64_t i) const
Definition: OMEbaseType.h:803
Ïúíþ ð Ø ˜ ˜ __text __TEXT € __apple_names __DWARF __apple_objc __DWARF __apple_namespac__DWARF H X __apple_types __DWARF l
Definition: tmp3.o.cpp:1
bool operator!=(const OMEtype &lArg, const OMEtype &rArg)
Definition: OMEtype_operators.cpp:5508
OME_FAST_CALL OMEtype & operator=(const int32_t i)
Definition: OMEbaseType.h:509
@ OME_FLOAT
Definition: OMEmanifests.h:82
OME_FAST_CALL OMEtype & operator=(const uint64_t ui)
Definition: OMEbaseType.h:557
const unsigned char OMEbase64alphabet[]
Definition: OMEbase64.cpp:20
OMEtype_OutputFlags_t
Definition: OMEbaseType.h:866
const char s[]
Definition: t.cpp:4
@ OPTIONAL_TYPE_FLAG
Definition: OMEbaseType.h:74
const char * typeName() const NONNULL_RETURN
Definition: OMEbaseType.h:874
OMEnlm & operator=(const OMEnlm &arg)
Definition: OMEnlm.h:142
@ OME_POINTER
Definition: OMEmanifests.h:92
OME_FAST_CALL OMEtype & operator=(const OMEarray &a)
Definition: OMEbaseType.h:650
static constexpr bool is64BitInteger(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:101
class OMEfixed * fixed
Definition: OMEbaseType.h:300
OME_FAST_CALL OMEtype & operator=(OMEoid *o)
Definition: OMEbaseType.h:642
void freeData() OME_ALWAYS_INLINE
Definition: OMEbaseType.h:309
@ OME_UINT16
Definition: OMEmanifests.h:98
@ CAN_DEMOTE
large size to small
Definition: OMEbaseType.h:67
OME_FAST_CALL OMEtype & operator=(const char *s)
Definition: OMEbaseType.h:591
OME_FAST_CALL READ_ONLY_OMEtype operator[](const int32_t i) const
Definition: OMEbaseType.h:810
Implements associative array of OMEtype elements.
Definition: OMEassoc.h:112
void addReadOnlyReference() OME_ALWAYS_INLINE
Definition: OMErefCount.h:84
Implements text and binary string storage.
Definition: OMEstring.h:305
Buffer into which OMEtype data is encoded.
Definition: OMEencode.h:54
OME_FAST_CALL OMEtype & operator=(const OMEassoc &a)
Definition: OMEbaseType.h:665
#define OME_REFERENCE_TYPE
A complex, reference counted type.
Definition: OMEtype.h:41
OME_FAST_CALL OMEtype & operator=(const uint16_t i)
Definition: OMEbaseType.h:501
@ OME_DOUBLE
Definition: OMEmanifests.h:83
OME_FAST_CALL OMEtype & operator[](const uint32_t i)
Definition: OMEbaseType.h:817
void determineCharacterSet()
Definition: OMEstring.h:391
class OMEoid * oid
Definition: OMEbaseType.h:297
const typedef void * OMEstringInROM
Points to immovable, read-only string data.
Definition: OMEstring.h:68
bool operator<(const OMEtype &lArg, const OMEtype &rArg)
Definition: OMEtype_operators.cpp:10983
@ OME_UINT32
Definition: OMEmanifests.h:96
OME_FAST_CALL OMEtype & operator=(const double f)
Definition: OMEbaseType.h:535
class OMEstring * s
Definition: OMEbaseType.h:299
#define OMEtypeClass(t)
Definition: OMEtype.h:54
#define NONNULL_CLASS_PARAMETERS(...)
Mark a function as never returning a null pointer.
Definition: compiler_hints.h:337
OMEextendedType(int64_t i)
Definition: OMEbaseType.h:42
OME_FAST_CALL OMEtype & operator=(const unsigned char c)
Definition: OMEbaseType.h:584
int32_t i
Definition: OMEbaseType.h:285
class OMEarray * array
Definition: OMEbaseType.h:294
void truncateToLength(size_t newLen)
Definition: OMEstring.h:531
OME_FAST_CALL READ_ONLY_OMEtype operator[](const uint32_t i) const
Definition: OMEbaseType.h:796
OMEextendedType(double f)
Definition: OMEbaseType.h:37
class OMEnlm * nlm
Definition: OMEbaseType.h:301
@ IDENTICAL_TYPES
same exact types
Definition: OMEbaseType.h:62
#define OME_SIMPLE_TYPE
A simple native type.
Definition: OMEtype.h:39
OME_FAST_CALL OMEtype & operator=(const OMEfixedConstant *f)
Definition: OMEbaseType.h:568
const _OMEtypeDescription _OMEtypeTable[POWER_OF_2_TYPE_TABLE_SIZE]
Definition: OMEtype.cpp:48
#define PAD
Definition: OMEbase64.cpp:18
OME_FAST_CALL OMEtype & operator[](const char *k) NONNULL_CLASS_PARAMETERS(2)
Definition: OMEbaseType.h:855
int makeUnique(OMEthread *thread, OMEtype &result, const OMEtype &arg)
Definition: OILdebug.cpp:357
static uint32_t typesAreAssignable(uint32_t srcType, uint32_t targetType) OME_CONST_FUNCTION
Definition: OMEbaseType.h:114
Public interface to an OME Native Language Message.
Definition: OMEnlm.h:98
OME_FAST_CALL OMEtype & operator[](const int64_t i)
Definition: OMEbaseType.h:824
OME_FAST_CALL OMEtype & operator=(const OMEstring &s)
Definition: OMEbaseType.h:605
OME_FAST_CALL OMEtype & operator=(const uint32_t i)
Definition: OMEbaseType.h:517
const char srcID[]
Definition: catSym.c:17
@ OME_STRING
Definition: OMEmanifests.h:85
void noteCharacterSet(uint_fast8_t c)
Definition: OMEstring.h:386
OME_FAST_CALL OMEtype & operator=(const OMEset &s)
Definition: OMEbaseType.h:680
#define OMEfundamentalType(t)
Definition: OMEtype.h:55
Implements an ordered list of OMEtype elements.
Definition: OMEset.h:64
@ CAN_PROMOTE
small size convertable to larger
Definition: OMEbaseType.h:66
TypeCompatibility_t
Definition: OMEbaseType.h:61
OME_FAST_CALL OMEtype & operator=(OMEstring *s)
Definition: OMEbaseType.h:612
@ TYPE_MASK
Definition: OMEbaseType.h:73
OMEtype * pointer
Definition: OMEbaseType.h:302
static constexpr bool isHeldBy32BitInteger(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:96
@ ASSUME_COMPATIBLE
left side is ANY
Definition: OMEbaseType.h:70
@ OME_NIL
Definition: OMEmanifests.h:78
const OMEtype & operator[](const OMEarray::ARRAY_SUBSCRIPT_t i) const
Definition: OMEnlm.h:191
@ OME_OID
Definition: OMEmanifests.h:84
float f
Definition: OMEbaseType.h:287
OMEtypes_t
Definition: OMEmanifests.h:77
uint_fast8_t getCharacterSet() const
Definition: OMEstring.h:396
OME_FAST_CALL OMEtype & operator=(const float f)
Definition: OMEbaseType.h:525
OME_FAST_CALL OMEtype & operator=(OMEfixed *f)
Definition: OMEbaseType.h:627
#define ILLEGAL
Definition: OMEbase64.cpp:16
OME_FAST_CALL OMEtype & operator[](const int32_t i)
Definition: OMEbaseType.h:831
size_t OMEhexToBinary(const unsigned char *src, size_t srcLen, unsigned char *dest, size_t destLen)
Convert hexadecimal text to binary.
Definition: OMEbase64.cpp:225
OMEstring * OMEbase64ToBinary(const OMEstring &source)
Convert base-64 encoded text to its binary representation.
Definition: OMEbase64.cpp:156
@ OME_UINT64
Definition: OMEmanifests.h:97
OME fundamental type implementation.
@ OME_CONST_POINTER
Definition: OMEbaseType.h:75
OME_FAST_CALL OMEtype & operator=(OMEnlm *m)
Definition: OMEbaseType.h:702
OME_FAST_CALL OMEtype & operator=(OMEarray *a)
Definition: OMEbaseType.h:657
OME_FAST_CALL OMEtype & operator=(OMEstringInROM s)
Definition: OMEbaseType.h:598
OME_FAST_CALL OMEtype & operator=(OMEset *s)
Definition: OMEbaseType.h:687
uint32_t ui
Definition: OMEbaseType.h:286
Utility class for type check operations on OMEtype interactions.
Definition: OMEbaseType.h:58
size_t length() const
Definition: OMEstring.h:401
static bool isTypeANY(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:82
const char srcID[] OME_USED
Definition: tick_time.cpp:24
OMEnlm(OMEnlmStorage *s)
Definition: OMEnlm.h:101
@ INCOMPATIBLE_TYPES
no conversion possible
Definition: OMEbaseType.h:68
#define OME_CONST_FUNCTION
Mark as an idempotent function that only accesses arguments – no global data.
Definition: compiler_hints.h:390
int64_t i64
Definition: OMEbaseType.h:33
static constexpr bool is32BitInteger(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:92
void getUniqueReference() OME_ALWAYS_INLINE
Definition: OMEbaseType.h:460
class OMEextendedType * extType
Definition: OMEbaseType.h:293
@ OME_SET
Definition: OMEmanifests.h:89
@ SAME_BASE_TYPE
exact same basic type
Definition: OMEbaseType.h:64
#define ntohl(x)
Definition: tmp.o.cpp:3101
bool operator<=(const OMEtype &lArg, const OMEtype &rArg)
Definition: OMEtype_operators.cpp:13657
OME constants and typedefs.
@ CAN_ASSIGN
can assign into type
Definition: OMEbaseType.h:63
Public interface to OME fixed-point type.
Definition: OMEfixed.h:85
#define OME_ALWAYS_INLINE
Tell the compiler to alway inline a function, regardless of optimization level.
Definition: compiler_hints.h:364
void dropReference(OMEnlmStorage *newData=nullptr) OME_ALWAYS_INLINE
Definition: OMErefCount.h:91
@ OME_UINT8
Definition: OMEmanifests.h:99
#define OME_FAST_CALL
Definition: compiler_hints.h:468
static constexpr bool isContainer(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:109
@ OME_FIXED
Definition: OMEmanifests.h:91
#define OME_DLL_EXPORT
Definition: compiler_hints.h:464
class OMEarray * arrayPtr
Definition: OMEbaseType.h:295
OMEstring * OMEbinaryToBase64(const OMEstring &source, bool breakIntoLines)
Convert binary data to base64 text encoding.
Definition: OMEbase64.cpp:112
Implements sparse array of OMEtype elements.
Definition: OMEarray.h:75
Public interface to an OME Object Identifier.
Definition: OMEoid.h:196
@ OME_ANY
Definition: OMEmanifests.h:93
uint64_t ui64
Definition: OMEbaseType.h:34
uint32_t type
Definition: OMEbaseType.h:304
bool operator>=(const OMEtype &lArg, const OMEtype &rArg)
Definition: OMEtype_operators.cpp:19005
const class OMEtype & READ_ONLY_OMEtype
A convenience typedef for performing read-only access to sparse and associative arrays....
Definition: OMEtype.h:58
STREAMTYPE & outputOnStream(STREAMTYPE &outputStream, int_fast16_t indent=0, uint8_t includeTypePrefix=OME_DEFAULT_COMPLEX_OUTPUT_MODE, const OMEstring *lang=nullptr) const
Output an OMEnlm object to an output stream.
Definition: OMEnlm.h:242
OMEextendedType(uint64_t ui)
Definition: OMEbaseType.h:47
OME_FAST_CALL READ_ONLY_OMEtype operator[](const char *k) const NONNULL_CLASS_PARAMETERS(2)
Definition: OMEbaseType.h:843
OME_FAST_CALL OMEtype & operator=(const char c)
Definition: OMEbaseType.h:577
OMEstring * OMEbinaryToHex(const unsigned char *srcBfr, size_t srcLen)
Convert binary data to hexadecimal characters.
Definition: OMEbase64.cpp:252
Storage record for large-sized elements on 32-bit hardware.
Definition: OMEbaseType.h:28
static uint32_t baseType(uint32_t t) OME_CONST_FUNCTION
Definition: OMEbaseType.h:78
static constexpr const char * typeName(const unsigned int t) OME_CONST_FUNCTION
Return text identifying the indicated OME type.
Definition: OMEbaseType.h:259
@ OME_ARRAY
Definition: OMEmanifests.h:86
bool operator>(const OMEtype &lArg, const OMEtype &rArg)
Definition: OMEtype_operators.cpp:16331
OME_FAST_CALL OMEtype & operator=(const OMEfixed &f)
Definition: OMEbaseType.h:620
OMEnlm * deepCopy() const
Definition: OMEnlm.h:222
class OMEassoc * assoc
Definition: OMEbaseType.h:296
class OMEset * set
Definition: OMEbaseType.h:298
Internal data type to generate fixed-point constant from floating-point value.
Definition: OMEfixed.h:26
static constexpr const char * enumName(const unsigned int t) OME_CONST_FUNCTION
Return text identifying the OME enum name for the indicated type.
Definition: OMEbaseType.h:272
#define htonl(x)
Definition: tmp.o.cpp:3098
double d
Definition: OMEfixed.h:27
~OMEextendedType()
Definition: OMEbaseType.h:52
OME_FAST_CALL OMEtype & operator=(const int64_t i)
Definition: OMEbaseType.h:546
char NONNULL_RETURN
Definition: compiler_hints.h:745
OMEstring * OMEconvertURIescapes(const OMEstring &arg)
Convert Uniform Resource Identifier escape sequences.
Definition: OMEbase64.cpp:314
double df
Definition: OMEbaseType.h:32
OME_FAST_CALL OMEtype & operator=(const OMEoid &o)
Definition: OMEbaseType.h:635
const unsigned char OMEhexDigits[]
Definition: OMEstring.cpp:19
@ OME_ASSOC
Definition: OMEmanifests.h:87
bool operator==(const OMEtype &lArg, const OMEtype &rArg)
Definition: OMEtype_operators.cpp:33
OMEstring * OMEmakeSafeURI(const OMEstring &arg)
Escape any special characters in an Uniform Resource Identifier.
Definition: OMEbase64.cpp:366
OME_FAST_CALL OMEtype & operator=(OMEassoc *a)
Definition: OMEbaseType.h:672
@ OME_INT32
Definition: OMEmanifests.h:79
OME_FAST_CALL OMEtype & operator=(const int16_t i)
Definition: OMEbaseType.h:493
@ OME_INT64
Definition: OMEmanifests.h:81