10#ifndef HPP_RTI_RECORDING_STORAGE_ESTORAGEFORMAT_HPP_
11#define HPP_RTI_RECORDING_STORAGE_ESTORAGEFORMAT_HPP_
15#include "reda/reda_string.h"
16#include "dds_c/dds_c_infrastructure.h"
18#include "dds/core/Exception.hpp"
20namespace rti {
namespace recording {
namespace storage {
25 static const DDS_DataRepresentationId_t INVALID_REPRESENTATION =
26 static_cast<DDS_DataRepresentationId_t
>(
27 RTI_CDR_ENCAPSULATION_ID_INVALID);
29 static const EStorageFormat XCDR() {
30 static const EStorageFormat XCDR(
33 DDS_XCDR_DATA_REPRESENTATION);
36 static const EStorageFormat XCDR2() {
37 static const EStorageFormat XCDR2(
40 DDS_XCDR2_DATA_REPRESENTATION);
43 static const EStorageFormat XCDR_AUTO() {
44 static const EStorageFormat XCDR_AUTO(
47 DDS_AUTO_DATA_REPRESENTATION);
50 static const EStorageFormat JSON_SQLITE() {
51 static const EStorageFormat JSON_SQLITE(
54 INVALID_REPRESENTATION);
60 static const EStorageFormat DESERIALIZED() {
61 static const EStorageFormat DESERIALIZED(
64 INVALID_REPRESENTATION);
68 static EStorageFormat from_string_ignore_case(
const std::string& value)
70 if (REDAString_iCompare(
72 XCDR().enum_value().c_str()) == 0) {
74 }
else if (REDAString_iCompare(
76 XCDR2().enum_value().c_str()) == 0) {
78 }
else if (REDAString_iCompare(
80 XCDR_AUTO().enum_value().c_str()) == 0) {
82 }
else if (REDAString_iCompare(
84 JSON_SQLITE().enum_value().c_str()) == 0) {
87 throw dds::core::UnsupportedError(
88 "Unrecognized DB Format value, must be one of "
89 "{XCDR,XCDR2,XCDR_AUTO,JSON_SQLITE}");
93 EStorageFormat(
const EStorageFormat& other)
94 : enum_value_(other.enum_value_),
95 enum_string_(other.enum_string_),
96 data_rep_id_(other.data_rep_id_){}
98 void operator =(
const EStorageFormat& other)
100 enum_value_ = other.enum_value_;
101 enum_string_ = other.enum_string_;
102 data_rep_id_ = other.data_rep_id_;
105 bool operator ==(
const EStorageFormat& other)
const
107 return enum_value_ == other.enum_value_;
110 bool operator !=(
const EStorageFormat& other)
const
112 return enum_value_ != other.enum_value_;
115 uint32_t value()
const {
return enum_value_; }
117 const std::string& enum_value()
const {
return enum_string_; }
123 DDS_DataRepresentationId_t data_representation()
const
129 uint32_t enum_value_;
130 std::string enum_string_;
131 DDS_DataRepresentationId_t data_rep_id_;
134 const uint32_t value,
135 const std::string& enum_string,
136 const DDS_DataRepresentationId_t rep_id) :
138 enum_string_(enum_string),
139 data_rep_id_(rep_id) {}
The RTI namespace.
Definition: RecordingServiceImpl.hpp:22