From 5bd4759b5df1fe8a79f2f8669c5f5a3d438f526c Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Thu, 19 Sep 2024 15:04:26 +0100 Subject: [PATCH] Add support for the uint64 and int64 data types to the RDM messaging --- common/messaging/DescriptorTest.cpp | 36 ++++++++++++++++---- common/messaging/MessagePrinter.cpp | 22 ++++++++++-- common/messaging/MessagePrinterTest.cpp | 7 +++- common/messaging/SchemaPrinter.cpp | 17 +++++++++ common/messaging/SchemaPrinterTest.cpp | 5 +++ common/rdm/DescriptorConsistencyChecker.cpp | 10 ++++++ common/rdm/DescriptorConsistencyChecker.h | 2 ++ common/rdm/GroupSizeCalculator.cpp | 24 +++++++++++++ common/rdm/GroupSizeCalculator.h | 4 +++ common/rdm/GroupSizeCalculatorTest.cpp | 12 ++++--- common/rdm/MessageDeserializer.cpp | 12 +++++++ common/rdm/MessageDeserializerTest.cpp | 26 ++++++++++---- common/rdm/MessageSerializer.cpp | 12 +++++++ common/rdm/MessageSerializerTest.cpp | 21 ++++++++++-- common/rdm/PidStoreLoader.cpp | 10 ++++++ common/rdm/Pids.proto | 2 ++ common/rdm/RDMAPI.cpp | 2 ++ common/rdm/StringMessageBuilder.cpp | 12 +++++++ common/rdm/StringMessageBuilderTest.cpp | 10 ++++-- common/rdm/VariableFieldSizeCalculator.cpp | 12 +++++++ common/rdm/VariableFieldSizeCalculator.h | 2 ++ include/ola/messaging/Descriptor.h | 2 ++ include/ola/messaging/DescriptorVisitor.h | 2 ++ include/ola/messaging/Message.h | 2 ++ include/ola/messaging/MessagePrinter.h | 8 +++-- include/ola/messaging/MessageVisitor.h | 2 ++ include/ola/messaging/SchemaPrinter.h | 2 ++ include/ola/messaging/StringMessageBuilder.h | 2 ++ include/ola/rdm/MessageDeserializer.h | 2 ++ include/ola/rdm/MessageSerializer.h | 2 ++ include/ola/rdm/StringMessageBuilder.h | 2 ++ python/ola/PidStore.py | 16 +++++++++ python/ola/PidStoreTest.py | 2 +- 33 files changed, 277 insertions(+), 27 deletions(-) diff --git a/common/messaging/DescriptorTest.cpp b/common/messaging/DescriptorTest.cpp index 37cce39c97..ea86378dbd 100644 --- a/common/messaging/DescriptorTest.cpp +++ b/common/messaging/DescriptorTest.cpp @@ -33,6 +33,10 @@ using std::vector; using ola::messaging::BoolFieldDescriptor; using ola::messaging::FieldDescriptor; using ola::messaging::FieldDescriptorGroup; +using ola::messaging::Int16FieldDescriptor; +using ola::messaging::Int32FieldDescriptor; +using ola::messaging::Int64FieldDescriptor; +using ola::messaging::Int8FieldDescriptor; using ola::messaging::IPV4FieldDescriptor; using ola::messaging::IPV6FieldDescriptor; using ola::messaging::MACFieldDescriptor; @@ -40,6 +44,7 @@ using ola::messaging::StringFieldDescriptor; using ola::messaging::UIDFieldDescriptor; using ola::messaging::UInt16FieldDescriptor; using ola::messaging::UInt32FieldDescriptor; +using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; class DescriptorTest: public CppUnit::TestFixture { @@ -113,7 +118,7 @@ void DescriptorTest::testFieldDescriptors() { OLA_ASSERT_EQ(1u, uint8_descriptor.MaxSize()); OLA_ASSERT_FALSE(uint8_descriptor.IsLittleEndian()); OLA_ASSERT_EQ(static_cast(10), - uint8_descriptor.Multiplier()); + uint8_descriptor.Multiplier()); OLA_ASSERT_TRUE(uint8_descriptor.FixedSize()); OLA_ASSERT_TRUE(uint8_descriptor.LimitedSize()); @@ -122,7 +127,7 @@ void DescriptorTest::testFieldDescriptors() { OLA_ASSERT_EQ(1u, uint8_descriptor2.MaxSize()); OLA_ASSERT_TRUE(uint8_descriptor2.IsLittleEndian()); OLA_ASSERT_EQ(static_cast(-1), - uint8_descriptor2.Multiplier()); + uint8_descriptor2.Multiplier()); OLA_ASSERT_TRUE(uint8_descriptor2.FixedSize()); OLA_ASSERT_TRUE(uint8_descriptor2.LimitedSize()); @@ -132,7 +137,7 @@ void DescriptorTest::testFieldDescriptors() { OLA_ASSERT_EQ(2u, uint16_descriptor.MaxSize()); OLA_ASSERT_FALSE(uint16_descriptor.IsLittleEndian()); OLA_ASSERT_EQ(static_cast(10), - uint16_descriptor.Multiplier()); + uint16_descriptor.Multiplier()); OLA_ASSERT_TRUE(uint16_descriptor.FixedSize()); OLA_ASSERT_TRUE(uint16_descriptor.LimitedSize()); @@ -141,7 +146,7 @@ void DescriptorTest::testFieldDescriptors() { OLA_ASSERT_EQ(2u, uint16_descriptor2.MaxSize()); OLA_ASSERT_TRUE(uint16_descriptor2.IsLittleEndian()); OLA_ASSERT_EQ(static_cast(-1), - uint16_descriptor2.Multiplier()); + uint16_descriptor2.Multiplier()); OLA_ASSERT_TRUE(uint16_descriptor2.FixedSize()); OLA_ASSERT_TRUE(uint16_descriptor2.LimitedSize()); @@ -151,7 +156,7 @@ void DescriptorTest::testFieldDescriptors() { OLA_ASSERT_EQ(4u, uint32_descriptor.MaxSize()); OLA_ASSERT_FALSE(uint32_descriptor.IsLittleEndian()); OLA_ASSERT_EQ(static_cast(10), - uint32_descriptor.Multiplier()); + uint32_descriptor.Multiplier()); OLA_ASSERT_TRUE(uint32_descriptor.FixedSize()); OLA_ASSERT_TRUE(uint32_descriptor.LimitedSize()); @@ -160,9 +165,28 @@ void DescriptorTest::testFieldDescriptors() { OLA_ASSERT_EQ(4u, uint32_descriptor2.MaxSize()); OLA_ASSERT_TRUE(uint32_descriptor2.IsLittleEndian()); OLA_ASSERT_EQ(static_cast(-1), - uint32_descriptor2.Multiplier()); + uint32_descriptor2.Multiplier()); OLA_ASSERT_TRUE(uint32_descriptor2.FixedSize()); OLA_ASSERT_TRUE(uint32_descriptor2.LimitedSize()); + + // uint64_t + UInt64FieldDescriptor uint64_descriptor("uint64", false, 10); + OLA_ASSERT_EQ(string("uint64"), uint64_descriptor.Name()); + OLA_ASSERT_EQ(8u, uint64_descriptor.MaxSize()); + OLA_ASSERT_FALSE(uint64_descriptor.IsLittleEndian()); + OLA_ASSERT_EQ(static_cast(10), + uint64_descriptor.Multiplier()); + OLA_ASSERT_TRUE(uint64_descriptor.FixedSize()); + OLA_ASSERT_TRUE(uint64_descriptor.LimitedSize()); + + UInt64FieldDescriptor uint64_descriptor2("uint64", true, -1); + OLA_ASSERT_EQ(string("uint64"), uint64_descriptor2.Name()); + OLA_ASSERT_EQ(8u, uint64_descriptor2.MaxSize()); + OLA_ASSERT_TRUE(uint64_descriptor2.IsLittleEndian()); + OLA_ASSERT_EQ(static_cast(-1), + uint64_descriptor2.Multiplier()); + OLA_ASSERT_TRUE(uint64_descriptor2.FixedSize()); + OLA_ASSERT_TRUE(uint64_descriptor2.LimitedSize()); } diff --git a/common/messaging/MessagePrinter.cpp b/common/messaging/MessagePrinter.cpp index 7123c15782..86286bcd6e 100644 --- a/common/messaging/MessagePrinter.cpp +++ b/common/messaging/MessagePrinter.cpp @@ -113,6 +113,15 @@ void GenericMessagePrinter::Visit(const BasicMessageField *message) { } +void GenericMessagePrinter::Visit(const BasicMessageField *message) { + const UInt64FieldDescriptor *descriptor = message->GetDescriptor(); + AppendUInt(descriptor->Name(), + message->Value(), + descriptor->LookupValue(message->Value()), + descriptor->Multiplier()); +} + + void GenericMessagePrinter::Visit(const BasicMessageField *message) { const Int8FieldDescriptor *descriptor = message->GetDescriptor(); AppendInt(descriptor->Name(), @@ -140,6 +149,15 @@ void GenericMessagePrinter::Visit(const BasicMessageField *message) { } +void GenericMessagePrinter::Visit(const BasicMessageField *message) { + const Int64FieldDescriptor *descriptor = message->GetDescriptor(); + AppendInt(descriptor->Name(), + message->Value(), + descriptor->LookupValue(message->Value()), + descriptor->Multiplier()); +} + + void GenericMessagePrinter::Visit(const GroupMessageField *message) { Stream() << string(m_indent, ' ') << TransformLabel(message->GetDescriptor()->Name()) << " {" << endl; @@ -155,7 +173,7 @@ void GenericMessagePrinter::PostVisit(const GroupMessageField *message) { void GenericMessagePrinter::AppendUInt(const string &name, - unsigned int value, + uint64_t value, const string &label, int8_t multiplier) { Stream() << string(m_indent, ' ') << TransformLabel(name) << ": "; @@ -170,7 +188,7 @@ void GenericMessagePrinter::AppendUInt(const string &name, void GenericMessagePrinter::AppendInt(const string &name, - int value, + int64_t value, const string &label, int8_t multiplier) { Stream() << string(m_indent, ' ') << TransformLabel(name) << ": "; diff --git a/common/messaging/MessagePrinterTest.cpp b/common/messaging/MessagePrinterTest.cpp index 5484370aa0..03179d971b 100644 --- a/common/messaging/MessagePrinterTest.cpp +++ b/common/messaging/MessagePrinterTest.cpp @@ -61,6 +61,8 @@ using ola::messaging::UIDFieldDescriptor; using ola::messaging::UIDMessageField; using ola::messaging::UInt32FieldDescriptor; using ola::messaging::UInt32MessageField; +using ola::messaging::UInt64FieldDescriptor; +using ola::messaging::UInt64MessageField; using ola::messaging::UInt8FieldDescriptor; using ola::messaging::UInt8MessageField; @@ -101,6 +103,7 @@ void GenericMessagePrinterTest::testSimplePrinter() { UInt8FieldDescriptor uint8_descriptor("Count", false, -3); Int8FieldDescriptor int8_descriptor("Delta", false, 1); Int16FieldDescriptor int16_descriptor("Rate", false, -1); + UInt64FieldDescriptor uint64_descriptor("Data"); // try a simple print first vector fields; @@ -120,12 +123,14 @@ void GenericMessagePrinterTest::testSimplePrinter() { fields.push_back(new UInt8MessageField(&uint8_descriptor, 4)); fields.push_back(new Int8MessageField(&int8_descriptor, 10)); fields.push_back(new Int16MessageField(&int16_descriptor, 10)); + fields.push_back(new UInt64MessageField(&uint64_descriptor, 424242424242)); Message message(fields); string expected = ( "On/Off: false\nip: 10.0.0.1\nipv6: ::ffff:192.168.0.1\n" "mac: 01:23:45:67:89:ab\nuid: 7a70:00000001\nName: foobar\nId: 42\n" - "Count: 4 x 10 ^ -3\nDelta: 10 x 10 ^ 1\nRate: 10 x 10 ^ -1\n"); + "Count: 4 x 10 ^ -3\nDelta: 10 x 10 ^ 1\nRate: 10 x 10 ^ -1\n" + "Data: 424242424242\n"); OLA_ASSERT_EQ(expected, m_printer.AsString(&message)); } diff --git a/common/messaging/SchemaPrinter.cpp b/common/messaging/SchemaPrinter.cpp index 62b07146b2..bd8b436c9d 100644 --- a/common/messaging/SchemaPrinter.cpp +++ b/common/messaging/SchemaPrinter.cpp @@ -89,6 +89,14 @@ void SchemaPrinter::Visit(const UInt32FieldDescriptor *descriptor) { } +void SchemaPrinter::Visit(const UInt64FieldDescriptor *descriptor) { + AppendHeading(descriptor->Name(), "uint64"); + MaybeAppendIntervals(descriptor->Intervals()); + MaybeAppendLabels(descriptor->Labels()); + m_str << endl; +} + + void SchemaPrinter::Visit(const Int8FieldDescriptor *descriptor) { AppendHeading(descriptor->Name(), "int8"); MaybeAppendIntervals(descriptor->Intervals()); @@ -112,6 +120,15 @@ void SchemaPrinter::Visit(const Int32FieldDescriptor *descriptor) { m_str << endl; } + +void SchemaPrinter::Visit(const Int64FieldDescriptor *descriptor) { + AppendHeading(descriptor->Name(), "int64"); + MaybeAppendIntervals(descriptor->Intervals()); + MaybeAppendLabels(descriptor->Labels()); + m_str << endl; +} + + void SchemaPrinter::Visit(const FieldDescriptorGroup *descriptor) { m_str << string(m_indent, ' ') << descriptor->Name() << " {" << endl; m_indent += m_indent_size; diff --git a/common/messaging/SchemaPrinterTest.cpp b/common/messaging/SchemaPrinterTest.cpp index 0eda1f5a36..f3bcd4ada1 100644 --- a/common/messaging/SchemaPrinterTest.cpp +++ b/common/messaging/SchemaPrinterTest.cpp @@ -42,9 +42,11 @@ using ola::messaging::SchemaPrinter; using ola::messaging::StringFieldDescriptor; using ola::messaging::UInt16FieldDescriptor; using ola::messaging::UInt32FieldDescriptor; +using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::messaging::Int16FieldDescriptor; using ola::messaging::Int32FieldDescriptor; +using ola::messaging::Int64FieldDescriptor; using ola::messaging::Int8FieldDescriptor; using ola::messaging::UIDFieldDescriptor; @@ -235,5 +237,8 @@ void SchemaPrinterTest::testIntervalTypes() { OLA_ASSERT_EQ( string("Count: int32: (-70000, 82560)\n"), GenerateIntervalString(-70000, 82560)); + OLA_ASSERT_EQ( + string("Count: int64: (-7000000000, 8256123456)\n"), + GenerateIntervalString(-7000000000, 8256123456)); } diff --git a/common/rdm/DescriptorConsistencyChecker.cpp b/common/rdm/DescriptorConsistencyChecker.cpp index e947d6d14e..4d9ef68b9b 100644 --- a/common/rdm/DescriptorConsistencyChecker.cpp +++ b/common/rdm/DescriptorConsistencyChecker.cpp @@ -79,6 +79,11 @@ void DescriptorConsistencyChecker::Visit( } +void DescriptorConsistencyChecker::Visit( + const ola::messaging::UInt64FieldDescriptor*) { +} + + void DescriptorConsistencyChecker::Visit( const ola::messaging::Int8FieldDescriptor*) { } @@ -94,6 +99,11 @@ void DescriptorConsistencyChecker::Visit( } +void DescriptorConsistencyChecker::Visit( + const ola::messaging::Int64FieldDescriptor*) { +} + + void DescriptorConsistencyChecker::Visit( const ola::messaging::FieldDescriptorGroup *descriptor) { if (!descriptor->FixedSize()) diff --git a/common/rdm/DescriptorConsistencyChecker.h b/common/rdm/DescriptorConsistencyChecker.h index a1ed804841..711453196f 100644 --- a/common/rdm/DescriptorConsistencyChecker.h +++ b/common/rdm/DescriptorConsistencyChecker.h @@ -59,9 +59,11 @@ class DescriptorConsistencyChecker void Visit(const ola::messaging::UInt8FieldDescriptor*); void Visit(const ola::messaging::UInt16FieldDescriptor*); void Visit(const ola::messaging::UInt32FieldDescriptor*); + void Visit(const ola::messaging::UInt64FieldDescriptor*); void Visit(const ola::messaging::Int8FieldDescriptor*); void Visit(const ola::messaging::Int16FieldDescriptor*); void Visit(const ola::messaging::Int32FieldDescriptor*); + void Visit(const ola::messaging::Int64FieldDescriptor*); void Visit(const ola::messaging::FieldDescriptorGroup*); void PostVisit(const ola::messaging::FieldDescriptorGroup*); diff --git a/common/rdm/GroupSizeCalculator.cpp b/common/rdm/GroupSizeCalculator.cpp index 18eb334a0f..b6ad1d288d 100644 --- a/common/rdm/GroupSizeCalculator.cpp +++ b/common/rdm/GroupSizeCalculator.cpp @@ -173,6 +173,12 @@ void GroupSizeCalculator::Visit( } +void GroupSizeCalculator::Visit( + const ola::messaging::UInt64FieldDescriptor *descriptor) { + m_non_groups.push_back(descriptor); +} + + void GroupSizeCalculator::Visit( const ola::messaging::Int8FieldDescriptor *descriptor) { m_non_groups.push_back(descriptor); @@ -191,6 +197,12 @@ void GroupSizeCalculator::Visit( } +void GroupSizeCalculator::Visit( + const ola::messaging::Int64FieldDescriptor *descriptor) { + m_non_groups.push_back(descriptor); +} + + void GroupSizeCalculator::Visit( const ola::messaging::FieldDescriptorGroup *descriptor) { m_groups.push_back(descriptor); @@ -294,6 +306,12 @@ void StaticGroupTokenCalculator::Visit( } +void StaticGroupTokenCalculator::Visit( + OLA_UNUSED const ola::messaging::UInt64FieldDescriptor *descriptor) { + m_token_count.top()++; +} + + void StaticGroupTokenCalculator::Visit( OLA_UNUSED const ola::messaging::Int8FieldDescriptor *descriptor) { m_token_count.top()++; @@ -312,6 +330,12 @@ void StaticGroupTokenCalculator::Visit( } +void StaticGroupTokenCalculator::Visit( + OLA_UNUSED const ola::messaging::Int64FieldDescriptor *descriptor) { + m_token_count.top()++; +} + + void StaticGroupTokenCalculator::Visit( const ola::messaging::FieldDescriptorGroup *descriptor) { m_token_count.push(0); diff --git a/common/rdm/GroupSizeCalculator.h b/common/rdm/GroupSizeCalculator.h index c15ec07cda..23d2c5d2b0 100644 --- a/common/rdm/GroupSizeCalculator.h +++ b/common/rdm/GroupSizeCalculator.h @@ -60,9 +60,11 @@ class StaticGroupTokenCalculator void Visit(const ola::messaging::UInt8FieldDescriptor*); void Visit(const ola::messaging::UInt16FieldDescriptor*); void Visit(const ola::messaging::UInt32FieldDescriptor*); + void Visit(const ola::messaging::UInt64FieldDescriptor*); void Visit(const ola::messaging::Int8FieldDescriptor*); void Visit(const ola::messaging::Int16FieldDescriptor*); void Visit(const ola::messaging::Int32FieldDescriptor*); + void Visit(const ola::messaging::Int64FieldDescriptor*); void Visit(const ola::messaging::FieldDescriptorGroup*); void PostVisit(const ola::messaging::FieldDescriptorGroup*); @@ -106,9 +108,11 @@ class GroupSizeCalculator: public ola::messaging::FieldDescriptorVisitor { void Visit(const ola::messaging::UInt8FieldDescriptor*); void Visit(const ola::messaging::UInt16FieldDescriptor*); void Visit(const ola::messaging::UInt32FieldDescriptor*); + void Visit(const ola::messaging::UInt64FieldDescriptor*); void Visit(const ola::messaging::Int8FieldDescriptor*); void Visit(const ola::messaging::Int16FieldDescriptor*); void Visit(const ola::messaging::Int32FieldDescriptor*); + void Visit(const ola::messaging::Int64FieldDescriptor*); void Visit(const ola::messaging::FieldDescriptorGroup*); void PostVisit(const ola::messaging::FieldDescriptorGroup*); diff --git a/common/rdm/GroupSizeCalculatorTest.cpp b/common/rdm/GroupSizeCalculatorTest.cpp index c86dd1dc18..3717e0fa02 100644 --- a/common/rdm/GroupSizeCalculatorTest.cpp +++ b/common/rdm/GroupSizeCalculatorTest.cpp @@ -37,12 +37,14 @@ using ola::messaging::IPV4FieldDescriptor; using ola::messaging::IPV6FieldDescriptor; using ola::messaging::Int16FieldDescriptor; using ola::messaging::Int32FieldDescriptor; +using ola::messaging::Int64FieldDescriptor; using ola::messaging::Int8FieldDescriptor; using ola::messaging::MACFieldDescriptor; using ola::messaging::StringFieldDescriptor; using ola::messaging::UIDFieldDescriptor; using ola::messaging::UInt16FieldDescriptor; using ola::messaging::UInt32FieldDescriptor; +using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::rdm::GroupSizeCalculator; using std::vector; @@ -82,9 +84,11 @@ void GroupSizeCalculatorTest::testSimpleCases() { fields.push_back(new UInt8FieldDescriptor("uint8")); fields.push_back(new UInt16FieldDescriptor("uint16")); fields.push_back(new UInt32FieldDescriptor("uint32")); + fields.push_back(new UInt64FieldDescriptor("uint64")); fields.push_back(new Int8FieldDescriptor("int8")); fields.push_back(new Int16FieldDescriptor("int16")); fields.push_back(new Int32FieldDescriptor("int32")); + fields.push_back(new Int64FieldDescriptor("int64")); fields.push_back(new StringFieldDescriptor("string", 0, 32)); fields.push_back(new IPV4FieldDescriptor("address")); fields.push_back(new IPV6FieldDescriptor("addressv6")); @@ -95,7 +99,7 @@ void GroupSizeCalculatorTest::testSimpleCases() { unsigned int token_count, group_repeat_count; OLA_ASSERT_TRUE( m_static_calculator.CalculateTokensRequired(&descriptor, &token_count)); - OLA_ASSERT_EQ(12u, token_count); // Actual token count + OLA_ASSERT_EQ(14u, token_count); // Actual token count OLA_ASSERT_EQ( @@ -108,21 +112,21 @@ void GroupSizeCalculatorTest::testSimpleCases() { OLA_ASSERT_EQ( GroupSizeCalculator::INSUFFICIENT_TOKENS, m_calculator.CalculateGroupSize( - 11, // Actual token count - 1 + 13, // Actual token count - 1 &descriptor, &group_repeat_count)); OLA_ASSERT_EQ( GroupSizeCalculator::NO_VARIABLE_GROUPS, m_calculator.CalculateGroupSize( - 12, // Actual token count + 14, // Actual token count &descriptor, &group_repeat_count)); OLA_ASSERT_EQ( GroupSizeCalculator::EXTRA_TOKENS, m_calculator.CalculateGroupSize( - 13, // Actual token count + 1 + 15, // Actual token count + 1 &descriptor, &group_repeat_count)); } diff --git a/common/rdm/MessageDeserializer.cpp b/common/rdm/MessageDeserializer.cpp index a3e6ec3360..fe4745c8ee 100644 --- a/common/rdm/MessageDeserializer.cpp +++ b/common/rdm/MessageDeserializer.cpp @@ -214,6 +214,12 @@ void MessageDeserializer::Visit( } +void MessageDeserializer::Visit( + const ola::messaging::IntegerFieldDescriptor *descriptor) { + IntVisit(descriptor); +} + + void MessageDeserializer::Visit( const ola::messaging::IntegerFieldDescriptor *descriptor) { IntVisit(descriptor); @@ -232,6 +238,12 @@ void MessageDeserializer::Visit( } +void MessageDeserializer::Visit( + const ola::messaging::IntegerFieldDescriptor *descriptor) { + IntVisit(descriptor); +} + + /** * @brief Visit a group field */ diff --git a/common/rdm/MessageDeserializerTest.cpp b/common/rdm/MessageDeserializerTest.cpp index d674b2c2f8..30e218031c 100644 --- a/common/rdm/MessageDeserializerTest.cpp +++ b/common/rdm/MessageDeserializerTest.cpp @@ -39,6 +39,7 @@ using ola::messaging::FieldDescriptor; using ola::messaging::FieldDescriptorGroup; using ola::messaging::Int16FieldDescriptor; using ola::messaging::Int32FieldDescriptor; +using ola::messaging::Int64FieldDescriptor; using ola::messaging::Int8FieldDescriptor; using ola::messaging::IPV4FieldDescriptor; using ola::messaging::IPV6FieldDescriptor; @@ -48,6 +49,7 @@ using ola::messaging::GenericMessagePrinter; using ola::messaging::StringFieldDescriptor; using ola::messaging::UInt16FieldDescriptor; using ola::messaging::UInt32FieldDescriptor; +using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::messaging::UIDFieldDescriptor; using ola::rdm::MessageDeserializer; @@ -130,12 +132,17 @@ void MessageDeserializerTest::testSimpleBigEndian() { fields.push_back(new Int16FieldDescriptor("int16")); fields.push_back(new UInt32FieldDescriptor("uint32")); fields.push_back(new Int32FieldDescriptor("int32")); + fields.push_back(new UInt64FieldDescriptor("uint64")); + fields.push_back(new Int64FieldDescriptor("int64")); Descriptor descriptor("Test Descriptor", fields); // now setup the data const uint8_t big_endian_data[] = { 0, 10, 246, 1, 0x2c, 0xfe, 10, - 1, 2, 3, 4, 0xfe, 6, 7, 8}; + 1, 2, 3, 4, 0xfe, 6, 7, 8, + 0, 0, 0, 17, 237, 142, 194, 0, + 255, 255, 255, 238, 18, 113, 62, 0 +}; // try to inflate with no data OLA_ASSERT_NULL(m_deserializer.InflateMessage( @@ -161,11 +168,12 @@ void MessageDeserializerTest::testSimpleBigEndian() { big_endian_data, sizeof(big_endian_data))); OLA_ASSERT_NOT_NULL(message.get()); - OLA_ASSERT_EQ(7u, message->FieldCount()); + OLA_ASSERT_EQ(9u, message->FieldCount()); const string expected = ( "bool: false\nuint8: 10\nint8: -10\nuint16: 300\nint16: -502\n" - "uint32: 16909060\nint32: -33159416\n"); + "uint32: 16909060\nint32: -33159416\n" + "uint64: 77000000000\nint64: -77000000000\n"); OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); } @@ -183,12 +191,17 @@ void MessageDeserializerTest::testSimpleLittleEndian() { fields.push_back(new Int16FieldDescriptor("int16", true)); fields.push_back(new UInt32FieldDescriptor("uint32", true)); fields.push_back(new Int32FieldDescriptor("int32", true)); + fields.push_back(new UInt64FieldDescriptor("uint64", true)); + fields.push_back(new Int64FieldDescriptor("int64", true)); Descriptor descriptor("Test Descriptor", fields); // now setup the data const uint8_t little_endian_data[] = { 1, 10, 246, 0x2c, 1, 10, 0xfe, - 4, 3, 2, 1, 8, 7, 6, 0xfe}; + 4, 3, 2, 1, 8, 7, 6, 0xfe, + 0, 194, 142, 237, 17, 0, 0, 0, + 0, 62, 113, 18, 238, 255, 255, 255 +}; // try to inflate with no data OLA_ASSERT_NULL(m_deserializer.InflateMessage( @@ -214,11 +227,12 @@ void MessageDeserializerTest::testSimpleLittleEndian() { little_endian_data, sizeof(little_endian_data))); OLA_ASSERT_NOT_NULL(message.get()); - OLA_ASSERT_EQ(7u, message->FieldCount()); + OLA_ASSERT_EQ(9u, message->FieldCount()); const string expected = ( "bool: true\nuint8: 10\nint8: -10\nuint16: 300\nint16: -502\n" - "uint32: 16909060\nint32: -33159416\n"); + "uint32: 16909060\nint32: -33159416\n" + "uint64: 77000000000\nint64: -77000000000\n"); OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); } diff --git a/common/rdm/MessageSerializer.cpp b/common/rdm/MessageSerializer.cpp index 8181157642..fa59738c10 100644 --- a/common/rdm/MessageSerializer.cpp +++ b/common/rdm/MessageSerializer.cpp @@ -137,6 +137,12 @@ void MessageSerializer::Visit( } +void MessageSerializer::Visit( + const ola::messaging::BasicMessageField *message) { + IntVisit(message); +} + + void MessageSerializer::Visit( const ola::messaging::BasicMessageField *message) { IntVisit(message); @@ -155,6 +161,12 @@ void MessageSerializer::Visit( } +void MessageSerializer::Visit( + const ola::messaging::BasicMessageField *message) { + IntVisit(message); +} + + void MessageSerializer::Visit( const ola::messaging::GroupMessageField *message) { (void) message; diff --git a/common/rdm/MessageSerializerTest.cpp b/common/rdm/MessageSerializerTest.cpp index 2eca076471..cc07156ac6 100644 --- a/common/rdm/MessageSerializerTest.cpp +++ b/common/rdm/MessageSerializerTest.cpp @@ -39,6 +39,7 @@ using ola::messaging::FieldDescriptor; using ola::messaging::FieldDescriptorGroup; using ola::messaging::Int16FieldDescriptor; using ola::messaging::Int32FieldDescriptor; +using ola::messaging::Int64FieldDescriptor; using ola::messaging::Int8FieldDescriptor; using ola::messaging::IPV4FieldDescriptor; using ola::messaging::IPV6FieldDescriptor; @@ -47,6 +48,7 @@ using ola::messaging::Message; using ola::messaging::StringFieldDescriptor; using ola::messaging::UInt16FieldDescriptor; using ola::messaging::UInt32FieldDescriptor; +using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::messaging::UIDFieldDescriptor; using ola::rdm::StringMessageBuilder; @@ -111,6 +113,8 @@ void MessageSerializerTest::testSimple() { fields.push_back(new Int16FieldDescriptor("int16")); fields.push_back(new UInt32FieldDescriptor("uint32")); fields.push_back(new Int32FieldDescriptor("int32")); + fields.push_back(new UInt64FieldDescriptor("uint64")); + fields.push_back(new Int64FieldDescriptor("int64")); fields.push_back(new IPV4FieldDescriptor("ip")); fields.push_back(new IPV6FieldDescriptor("ipv6")); fields.push_back(new MACFieldDescriptor("mac")); @@ -126,6 +130,8 @@ void MessageSerializerTest::testSimple() { inputs.push_back("-400"); inputs.push_back("66000"); inputs.push_back("-66000"); + inputs.push_back("77000000000"); + inputs.push_back("-77000000000"); inputs.push_back("10.0.0.1"); inputs.push_back("::ffff:192.168.0.1"); inputs.push_back("01:23:45:67:89:ab"); @@ -140,11 +146,13 @@ void MessageSerializerTest::testSimple() { const uint8_t *data = serializer.SerializeMessage(message.get(), &packed_length); OLA_ASSERT_NOT_NULL(data); - OLA_ASSERT_EQ(44u, packed_length); + OLA_ASSERT_EQ(60u, packed_length); uint8_t expected[] = { 1, 1, 253, 1, 44, 254, 112, 0, 1, 1, 208, 255, 254, 254, 48, + 0, 0, 0, 17, 237, 142, 194, 0, + 255, 255, 255, 238, 18, 113, 62, 0, 10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 192, 168, 0, 1, 1, 35, 69, 103, 137, 171, @@ -227,6 +235,8 @@ void MessageSerializerTest::testLittleEndian() { fields.push_back(new Int16FieldDescriptor("int16", true)); fields.push_back(new UInt32FieldDescriptor("uint32", true)); fields.push_back(new Int32FieldDescriptor("int32", true)); + fields.push_back(new UInt64FieldDescriptor("uint64", true)); + fields.push_back(new Int64FieldDescriptor("int64", true)); Descriptor descriptor("Test Descriptor", fields); // now setup the inputs @@ -237,6 +247,8 @@ void MessageSerializerTest::testLittleEndian() { inputs.push_back("-400"); inputs.push_back("66000"); inputs.push_back("-66000"); + inputs.push_back("77000000000"); + inputs.push_back("-77000000000"); auto_ptr message(BuildMessage(descriptor, inputs)); @@ -247,11 +259,14 @@ void MessageSerializerTest::testLittleEndian() { const uint8_t *data = serializer.SerializeMessage(message.get(), &packed_length); OLA_ASSERT_NOT_NULL(data); - OLA_ASSERT_EQ(14u, packed_length); + OLA_ASSERT_EQ(30u, packed_length); uint8_t expected[] = { 1, 253, 44, 1, 112, 254, - 208, 1, 1, 0, 48, 254, 254, 255}; + 208, 1, 1, 0, 48, 254, 254, 255, + 0, 194, 142, 237, 17, 0, 0, 0, + 0, 62, 113, 18, 238, 255, 255, 255 +}; OLA_ASSERT_DATA_EQUALS(expected, sizeof(expected), data, packed_length); } diff --git a/common/rdm/PidStoreLoader.cpp b/common/rdm/PidStoreLoader.cpp index adf5594e6b..c1424260d9 100644 --- a/common/rdm/PidStoreLoader.cpp +++ b/common/rdm/PidStoreLoader.cpp @@ -448,6 +448,11 @@ const FieldDescriptor *PidStoreLoader::FieldToFieldDescriptor( IntegerFieldToFieldDescriptor( field); break; + case ola::rdm::pid::UINT64: + descriptor = + IntegerFieldToFieldDescriptor( + field); + break; case ola::rdm::pid::INT8: descriptor = IntegerFieldToFieldDescriptor( @@ -463,6 +468,11 @@ const FieldDescriptor *PidStoreLoader::FieldToFieldDescriptor( IntegerFieldToFieldDescriptor( field); break; + case ola::rdm::pid::INT64: + descriptor = + IntegerFieldToFieldDescriptor( + field); + break; case ola::rdm::pid::STRING: descriptor = StringFieldToFieldDescriptor(field); break; diff --git a/common/rdm/Pids.proto b/common/rdm/Pids.proto index 19010f7ad8..9c3fdcbe03 100644 --- a/common/rdm/Pids.proto +++ b/common/rdm/Pids.proto @@ -43,6 +43,8 @@ enum FieldType { UID = 11; MAC = 12; IPV6 = 13; + UINT64 = 14; + INT64 = 15; } // A value which has a label applied diff --git a/common/rdm/RDMAPI.cpp b/common/rdm/RDMAPI.cpp index 89d3c525c5..481eba8301 100644 --- a/common/rdm/RDMAPI.cpp +++ b/common/rdm/RDMAPI.cpp @@ -33,6 +33,7 @@ #include "ola/rdm/RDMAPIImplInterface.h" #include "ola/rdm/RDMEnums.h" #include "ola/rdm/UID.h" +#include "ola/strings/Format.h" namespace ola { namespace rdm { @@ -45,6 +46,7 @@ using ola::SingleUseCallback2; using ola::SingleUseCallback4; using ola::network::HostToNetwork; using ola::network::NetworkToHost; +using ola::strings::IntToString; /* diff --git a/common/rdm/StringMessageBuilder.cpp b/common/rdm/StringMessageBuilder.cpp index da6fad314e..00daaac9aa 100644 --- a/common/rdm/StringMessageBuilder.cpp +++ b/common/rdm/StringMessageBuilder.cpp @@ -294,6 +294,12 @@ void StringMessageBuilder::Visit( } +void StringMessageBuilder::Visit( + const ola::messaging::UInt64FieldDescriptor *descriptor) { + VisitInt(descriptor); +} + + void StringMessageBuilder::Visit( const ola::messaging::Int8FieldDescriptor *descriptor) { VisitInt(descriptor); @@ -312,6 +318,12 @@ void StringMessageBuilder::Visit( } +void StringMessageBuilder::Visit( + const ola::messaging::Int64FieldDescriptor *descriptor) { + VisitInt(descriptor); +} + + /** * Visit a group */ diff --git a/common/rdm/StringMessageBuilderTest.cpp b/common/rdm/StringMessageBuilderTest.cpp index 6ee21f16e8..187cf64af1 100644 --- a/common/rdm/StringMessageBuilderTest.cpp +++ b/common/rdm/StringMessageBuilderTest.cpp @@ -41,12 +41,14 @@ using ola::messaging::IPV4FieldDescriptor; using ola::messaging::IPV6FieldDescriptor; using ola::messaging::Int16FieldDescriptor; using ola::messaging::Int32FieldDescriptor; +using ola::messaging::Int64FieldDescriptor; using ola::messaging::Int8FieldDescriptor; using ola::messaging::MACFieldDescriptor; using ola::messaging::Message; using ola::messaging::StringFieldDescriptor; using ola::messaging::UInt16FieldDescriptor; using ola::messaging::UInt32FieldDescriptor; +using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::rdm::StringMessageBuilder; using std::auto_ptr; @@ -142,9 +144,11 @@ void StringBuilderTest::testSimpleBuilder() { fields.push_back(new UInt8FieldDescriptor("uint8")); fields.push_back(new UInt16FieldDescriptor("uint16")); fields.push_back(new UInt32FieldDescriptor("uint32")); + fields.push_back(new UInt64FieldDescriptor("uint64")); fields.push_back(new Int8FieldDescriptor("int8")); fields.push_back(new Int16FieldDescriptor("int16")); fields.push_back(new Int32FieldDescriptor("int32")); + fields.push_back(new Int64FieldDescriptor("int64")); fields.push_back(new StringFieldDescriptor("string", 0, 32)); fields.push_back(new UInt16FieldDescriptor("hex uint16")); Descriptor descriptor("Test Descriptor", fields); @@ -163,9 +167,11 @@ void StringBuilderTest::testSimpleBuilder() { inputs.push_back("255"); inputs.push_back("300"); inputs.push_back("66000"); + inputs.push_back("77000000000"); inputs.push_back("-128"); inputs.push_back("-300"); inputs.push_back("-66000"); + inputs.push_back("-77000000000"); inputs.push_back("foo"); inputs.push_back("0x400"); @@ -180,8 +186,8 @@ void StringBuilderTest::testSimpleBuilder() { "bool1: true\nbool2: false\nbool3: true\nbool4: false\nbool5: true\n" "bool6: false\nip1: 10.0.0.1\nipv61: ::ffff:192.168.0.1\n" "mac1: 01:23:45:67:89:ab\nuint8: 255\nuint16: 300\nuint32: 66000\n" - "int8: -128\nint16: -300\nint32: -66000\nstring: foo\n" - "hex uint16: 1024\n"); + "uint64: 77000000000\nint8: -128\nint16: -300\nint32: -66000\n" + "int64: -77000000000\nstring: foo\nhex uint16: 1024\n"); OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); } diff --git a/common/rdm/VariableFieldSizeCalculator.cpp b/common/rdm/VariableFieldSizeCalculator.cpp index f30c55f4ed..2487d10cce 100644 --- a/common/rdm/VariableFieldSizeCalculator.cpp +++ b/common/rdm/VariableFieldSizeCalculator.cpp @@ -169,6 +169,12 @@ void VariableFieldSizeCalculator::Visit( } +void VariableFieldSizeCalculator::Visit( + const ola::messaging::UInt64FieldDescriptor *descriptor) { + m_fixed_size_sum += descriptor->MaxSize(); +} + + void VariableFieldSizeCalculator::Visit( const ola::messaging::Int8FieldDescriptor *descriptor) { m_fixed_size_sum += descriptor->MaxSize(); @@ -187,6 +193,12 @@ void VariableFieldSizeCalculator::Visit( } +void VariableFieldSizeCalculator::Visit( + const ola::messaging::Int64FieldDescriptor *descriptor) { + m_fixed_size_sum += descriptor->MaxSize(); +} + + void VariableFieldSizeCalculator::Visit( const ola::messaging::FieldDescriptorGroup *descriptor) { if (descriptor->FixedSize()) diff --git a/common/rdm/VariableFieldSizeCalculator.h b/common/rdm/VariableFieldSizeCalculator.h index 4e224b0afa..d4ef1e0973 100644 --- a/common/rdm/VariableFieldSizeCalculator.h +++ b/common/rdm/VariableFieldSizeCalculator.h @@ -70,9 +70,11 @@ class VariableFieldSizeCalculator void Visit(const ola::messaging::UInt8FieldDescriptor*); void Visit(const ola::messaging::UInt16FieldDescriptor*); void Visit(const ola::messaging::UInt32FieldDescriptor*); + void Visit(const ola::messaging::UInt64FieldDescriptor*); void Visit(const ola::messaging::Int8FieldDescriptor*); void Visit(const ola::messaging::Int16FieldDescriptor*); void Visit(const ola::messaging::Int32FieldDescriptor*); + void Visit(const ola::messaging::Int64FieldDescriptor*); void Visit(const ola::messaging::FieldDescriptorGroup*); void PostVisit(const ola::messaging::FieldDescriptorGroup*) {} diff --git a/include/ola/messaging/Descriptor.h b/include/ola/messaging/Descriptor.h index f997a9a00d..68bd4c8890 100644 --- a/include/ola/messaging/Descriptor.h +++ b/include/ola/messaging/Descriptor.h @@ -287,9 +287,11 @@ class IntegerFieldDescriptor: public FieldDescriptor { typedef IntegerFieldDescriptor UInt8FieldDescriptor; typedef IntegerFieldDescriptor UInt16FieldDescriptor; typedef IntegerFieldDescriptor UInt32FieldDescriptor; +typedef IntegerFieldDescriptor UInt64FieldDescriptor; typedef IntegerFieldDescriptor Int8FieldDescriptor; typedef IntegerFieldDescriptor Int16FieldDescriptor; typedef IntegerFieldDescriptor Int32FieldDescriptor; +typedef IntegerFieldDescriptor Int64FieldDescriptor; /** diff --git a/include/ola/messaging/DescriptorVisitor.h b/include/ola/messaging/DescriptorVisitor.h index 5b5820d588..37ae615f1d 100644 --- a/include/ola/messaging/DescriptorVisitor.h +++ b/include/ola/messaging/DescriptorVisitor.h @@ -57,9 +57,11 @@ class FieldDescriptorVisitor { virtual void Visit(const IntegerFieldDescriptor*) = 0; virtual void Visit(const IntegerFieldDescriptor*) = 0; virtual void Visit(const IntegerFieldDescriptor*) = 0; + virtual void Visit(const IntegerFieldDescriptor*) = 0; virtual void Visit(const IntegerFieldDescriptor*) = 0; virtual void Visit(const IntegerFieldDescriptor*) = 0; virtual void Visit(const IntegerFieldDescriptor*) = 0; + virtual void Visit(const IntegerFieldDescriptor*) = 0; virtual void Visit(const FieldDescriptorGroup*) = 0; virtual void PostVisit(const FieldDescriptorGroup*) = 0; }; diff --git a/include/ola/messaging/Message.h b/include/ola/messaging/Message.h index ecc56bd2a2..d12da39f78 100644 --- a/include/ola/messaging/Message.h +++ b/include/ola/messaging/Message.h @@ -258,9 +258,11 @@ class BasicMessageField: public MessageFieldInterface { typedef BasicMessageField UInt8MessageField; typedef BasicMessageField UInt16MessageField; typedef BasicMessageField UInt32MessageField; +typedef BasicMessageField UInt64MessageField; typedef BasicMessageField Int8MessageField; typedef BasicMessageField Int16MessageField; typedef BasicMessageField Int32MessageField; +typedef BasicMessageField Int64MessageField; /** diff --git a/include/ola/messaging/MessagePrinter.h b/include/ola/messaging/MessagePrinter.h index 2f2f363664..c1ee1bd440 100644 --- a/include/ola/messaging/MessagePrinter.h +++ b/include/ola/messaging/MessagePrinter.h @@ -47,9 +47,11 @@ class MessagePrinter: public MessageVisitor { virtual void Visit(const BasicMessageField*) {} virtual void Visit(const BasicMessageField*) {} virtual void Visit(const BasicMessageField*) {} + virtual void Visit(const BasicMessageField*) {} virtual void Visit(const BasicMessageField*) {} virtual void Visit(const BasicMessageField*) {} virtual void Visit(const BasicMessageField*) {} + virtual void Visit(const BasicMessageField*) {} virtual void Visit(const GroupMessageField*) {} virtual void PostVisit(const GroupMessageField*) {} @@ -86,9 +88,11 @@ class GenericMessagePrinter: public MessagePrinter { virtual void Visit(const BasicMessageField*); virtual void Visit(const BasicMessageField*); virtual void Visit(const BasicMessageField*); + virtual void Visit(const BasicMessageField*); virtual void Visit(const BasicMessageField*); virtual void Visit(const BasicMessageField*); virtual void Visit(const BasicMessageField*); + virtual void Visit(const BasicMessageField*); virtual void Visit(const GroupMessageField*); virtual void PostVisit(const GroupMessageField*); @@ -98,11 +102,11 @@ class GenericMessagePrinter: public MessagePrinter { unsigned int m_indent, m_indent_size; void AppendUInt(const std::string &name, - unsigned int value, + uint64_t value, const std::string &label, int8_t multiplier); void AppendInt(const std::string &name, - int value, + int64_t value, const std::string &label, int8_t multiplier); void AppendMultiplier(int8_t multiplier); diff --git a/include/ola/messaging/MessageVisitor.h b/include/ola/messaging/MessageVisitor.h index 81b55ed965..f5cf16d457 100644 --- a/include/ola/messaging/MessageVisitor.h +++ b/include/ola/messaging/MessageVisitor.h @@ -54,9 +54,11 @@ class MessageVisitor { virtual void Visit(const BasicMessageField*) = 0; virtual void Visit(const BasicMessageField*) = 0; virtual void Visit(const BasicMessageField*) = 0; + virtual void Visit(const BasicMessageField*) = 0; virtual void Visit(const BasicMessageField*) = 0; virtual void Visit(const BasicMessageField*) = 0; virtual void Visit(const BasicMessageField*) = 0; + virtual void Visit(const BasicMessageField*) = 0; virtual void Visit(const GroupMessageField*) = 0; virtual void PostVisit(const GroupMessageField*) = 0; }; diff --git a/include/ola/messaging/SchemaPrinter.h b/include/ola/messaging/SchemaPrinter.h index 95aa7c9e6b..0d789a769c 100644 --- a/include/ola/messaging/SchemaPrinter.h +++ b/include/ola/messaging/SchemaPrinter.h @@ -57,9 +57,11 @@ class SchemaPrinter: public FieldDescriptorVisitor { void Visit(const UInt8FieldDescriptor*); void Visit(const UInt16FieldDescriptor*); void Visit(const UInt32FieldDescriptor*); + void Visit(const UInt64FieldDescriptor*); void Visit(const Int8FieldDescriptor*); void Visit(const Int16FieldDescriptor*); void Visit(const Int32FieldDescriptor*); + void Visit(const Int64FieldDescriptor*); void Visit(const FieldDescriptorGroup*); void PostVisit(const FieldDescriptorGroup*); diff --git a/include/ola/messaging/StringMessageBuilder.h b/include/ola/messaging/StringMessageBuilder.h index 12b7273fd3..ab7343d197 100644 --- a/include/ola/messaging/StringMessageBuilder.h +++ b/include/ola/messaging/StringMessageBuilder.h @@ -49,9 +49,11 @@ class StringMessageBuilder: public FieldDescriptorVisitor { void Visit(const IntegerFieldDescriptor*); void Visit(const IntegerFieldDescriptor*); void Visit(const IntegerFieldDescriptor*); + void Visit(const IntegerFieldDescriptor*); void Visit(const IntegerFieldDescriptor*); void Visit(const IntegerFieldDescriptor*); void Visit(const IntegerFieldDescriptor*); + void Visit(const IntegerFieldDescriptor*); void Visit(const FieldDescriptorGroup*); void PostVisit(const FieldDescriptorGroup*); diff --git a/include/ola/rdm/MessageDeserializer.h b/include/ola/rdm/MessageDeserializer.h index 5e320653af..ec75dddf47 100644 --- a/include/ola/rdm/MessageDeserializer.h +++ b/include/ola/rdm/MessageDeserializer.h @@ -64,9 +64,11 @@ class MessageDeserializer: public ola::messaging::FieldDescriptorVisitor { void Visit(const ola::messaging::IntegerFieldDescriptor*); void Visit(const ola::messaging::IntegerFieldDescriptor*); void Visit(const ola::messaging::IntegerFieldDescriptor*); + void Visit(const ola::messaging::IntegerFieldDescriptor*); void Visit(const ola::messaging::IntegerFieldDescriptor*); void Visit(const ola::messaging::IntegerFieldDescriptor*); void Visit(const ola::messaging::IntegerFieldDescriptor*); + void Visit(const ola::messaging::IntegerFieldDescriptor*); void Visit(const ola::messaging::FieldDescriptorGroup*); void PostVisit(const ola::messaging::FieldDescriptorGroup*) {} diff --git a/include/ola/rdm/MessageSerializer.h b/include/ola/rdm/MessageSerializer.h index cf6f51f86e..e0d30c06a6 100644 --- a/include/ola/rdm/MessageSerializer.h +++ b/include/ola/rdm/MessageSerializer.h @@ -55,9 +55,11 @@ class MessageSerializer: public ola::messaging::MessageVisitor { void Visit(const ola::messaging::BasicMessageField*); void Visit(const ola::messaging::BasicMessageField*); void Visit(const ola::messaging::BasicMessageField*); + void Visit(const ola::messaging::BasicMessageField*); void Visit(const ola::messaging::BasicMessageField*); void Visit(const ola::messaging::BasicMessageField*); void Visit(const ola::messaging::BasicMessageField*); + void Visit(const ola::messaging::BasicMessageField*); void Visit(const ola::messaging::GroupMessageField*); void PostVisit(const ola::messaging::GroupMessageField*); diff --git a/include/ola/rdm/StringMessageBuilder.h b/include/ola/rdm/StringMessageBuilder.h index ed2bfbdc49..8d00dd6677 100644 --- a/include/ola/rdm/StringMessageBuilder.h +++ b/include/ola/rdm/StringMessageBuilder.h @@ -69,9 +69,11 @@ class StringMessageBuilder: public ola::messaging::FieldDescriptorVisitor { void Visit(const ola::messaging::UInt8FieldDescriptor*); void Visit(const ola::messaging::UInt16FieldDescriptor*); void Visit(const ola::messaging::UInt32FieldDescriptor*); + void Visit(const ola::messaging::UInt64FieldDescriptor*); void Visit(const ola::messaging::Int8FieldDescriptor*); void Visit(const ola::messaging::Int16FieldDescriptor*); void Visit(const ola::messaging::Int32FieldDescriptor*); + void Visit(const ola::messaging::Int64FieldDescriptor*); void Visit(const ola::messaging::FieldDescriptorGroup*); void PostVisit(const ola::messaging::FieldDescriptorGroup*); diff --git a/python/ola/PidStore.py b/python/ola/PidStore.py index 5742b35e92..c1dacbf4de 100644 --- a/python/ola/PidStore.py +++ b/python/ola/PidStore.py @@ -528,6 +528,18 @@ def __init__(self, name, **kwargs): super(UInt32, self).__init__(name, 'I', 0xffffffff, **kwargs) +class Int64(IntAtom): + """An eight-byte signed field.""" + def __init__(self, name, **kwargs): + super(Int64, self).__init__(name, 'q', 0xffffffffffffffff, **kwargs) + + +class UInt64(IntAtom): + """An eight-byte unsigned field.""" + def __init__(self, name, **kwargs): + super(UInt64, self).__init__(name, 'Q', 0xffffffffffffffff, **kwargs) + + class IPV4(IntAtom): """A four-byte IPV4 address.""" def __init__(self, name, **kwargs): @@ -1292,6 +1304,10 @@ def _FieldToAtom(self, field): return Int32(field_name, **args) elif field.type == Pids_pb2.UINT32: return UInt32(field_name, **args) + elif field.type == Pids_pb2.INT64: + return Int64(field_name, **args) + elif field.type == Pids_pb2.UINT64: + return UInt64(field_name, **args) elif field.type == Pids_pb2.IPV4: return IPV4(field_name, **args) elif field.type == Pids_pb2.IPV6: diff --git a/python/ola/PidStoreTest.py b/python/ola/PidStoreTest.py index e09226f1fd..410b557acd 100755 --- a/python/ola/PidStoreTest.py +++ b/python/ola/PidStoreTest.py @@ -176,7 +176,7 @@ def testCmp(self): g1setreq = PidStore.Group("srg", [PidStore.MACAtom("mac"), PidStore.IPV4("ipv4"), PidStore.IPV6Atom("ipv6"), - PidStore.Int8("i32")]) + PidStore.Int8("i8")]) p1b = PidStore.Pid("base", 42, None, None, g1getreq, g1setreq)