Commit 1eddfc63 authored by Charles Delort's avatar Charles Delort
Browse files

CORALCOOL-3025: Add 128M blobs to cool

parent a106fa1b
......@@ -66,7 +66,8 @@ namespace cool
String64k,
String16M,
Blob64k,
Blob16M
Blob16M,
Blob128M
};
#ifdef COOL400CPP11ENUM
......
......@@ -48,6 +48,7 @@ namespace cool {
typedef coral::Blob Blob64k;
typedef coral::Blob Blob16M;
typedef coral::Blob Blob128M;
// -------------------------------------------------------------------------
/// Constant definitions for the min/max values of a few supported types.
......
......@@ -60,6 +60,7 @@ void FieldSelection::initialize()
case StorageType::TypeId::Bool:
case StorageType::TypeId::Blob64k:
case StorageType::TypeId::Blob16M:
case StorageType::TypeId::Blob128M:
case StorageType::TypeId::String255:
case StorageType::TypeId::String4k:
case StorageType::TypeId::String64k:
......@@ -284,6 +285,9 @@ bool FieldSelection::select( const IRecord& record ) const
case StorageType::TypeId::Blob16M:
return compareBlobs( field.data<cool::Blob16M>(),
m_relation,ref.data<cool::Blob16M>() );
case StorageType::TypeId::Blob128M:
return compareBlobs( field.data<cool::Blob128M>(),
m_relation,ref.data<cool::Blob128M>() );
default:
throw InternalErrorException
( "PANIC! Unsupported type in Fieldselection::select()",
......
......@@ -143,6 +143,8 @@ void FieldSpecification::validate( const coral::Attribute& attribute,
storageType().validate( attribute.data<Blob64k>() ); break;
case StorageType::TypeId::Blob16M:
storageType().validate( attribute.data<Blob16M>() ); break;
case StorageType::TypeId::Blob128M:
storageType().validate( attribute.data<Blob128M>() ); break;
default:
std::stringstream out;
out << "PANIC! Unknown type '" << storageType().id()
......
......@@ -29,6 +29,7 @@ const std::string cool::StorageType::name() const
case StorageType::TypeId::String16M: return "String16M";
case StorageType::TypeId::Blob64k: return "Blob64k";
case StorageType::TypeId::Blob16M: return "Blob16M";
case StorageType::TypeId::Blob128M: return "Blob128M";
}
std::stringstream out;
out << "PANIC! Unknown type '" << m_id << "' in StorageType::name()";
......@@ -58,6 +59,7 @@ const std::type_info& cool::StorageType::cppType() const
case StorageType::TypeId::String16M: return typeid( cool::String16M );
case StorageType::TypeId::Blob64k: return typeid( cool::Blob64k );
case StorageType::TypeId::Blob16M: return typeid( cool::Blob16M );
case StorageType::TypeId::Blob128M: return typeid( cool::Blob128M );
}
std::stringstream out;
out << "PANIC! Unknown type '" << m_id << "' in StorageType::cppType()";
......@@ -87,6 +89,7 @@ size_t cool::StorageType::maxSize() const
case StorageType::TypeId::String16M: return 16777215;
case StorageType::TypeId::Blob64k: return 65535;
case StorageType::TypeId::Blob16M: return 16777215;
case StorageType::TypeId::Blob128M: return 134217727;
}
std::stringstream out;
out << "PANIC! Unknown type '" << m_id << "' in StorageType::maxSize()";
......@@ -134,6 +137,8 @@ const cool::StorageType& cool::StorageType::storageType( const TypeId& id )
{ static const StorageType type( id ); return type; }
case StorageType::TypeId::Blob16M:
{ static const StorageType type( id ); return type; }
case StorageType::TypeId::Blob128M:
{ static const StorageType type( id ); return type; }
}
std::stringstream out;
out << "PANIC! Unknown type '" << id << "' in StorageType::storageType()";
......@@ -170,6 +175,7 @@ void cool::StorageType::validate( const std::type_info& cppTypeOfData,
break;
case StorageType::TypeId::Blob64k:
case StorageType::TypeId::Blob16M:
case StorageType::TypeId::Blob128M:
{
const coral::Blob& data =
*( static_cast<const coral::Blob*>( addressOfData ) );
......
......@@ -51,6 +51,7 @@ public:
spec.extend( "A_String16M", StorageType::TypeId::String16M );
spec.extend( "A_Blob64k", StorageType::TypeId::Blob64k );
spec.extend( "A_Blob16M", StorageType::TypeId::Blob16M );
spec.extend( "A_Blob128M", StorageType::TypeId::Blob128M );
std::cout << "Size=" << spec.size() << std::endl;
for ( unsigned i=0; i<spec.size(); i++ ) {
std::cout << "Item #" << i << ": " << spec[i].name()
......
......@@ -57,6 +57,7 @@ public:
spec.extend( "A_String16M", StorageType::TypeId::String16M );
spec.extend( "A_Blob64k", StorageType::TypeId::Blob64k );
spec.extend( "A_Blob16M", StorageType::TypeId::Blob16M );
spec.extend( "A_Blob128M", StorageType::TypeId::Blob128M );
Record rec( spec );
UInt32 size = rec.specification().size();
......
......@@ -356,6 +356,7 @@ namespace cool
TD(p, String16M)
TD(q, Blob64k)
TD(r, Blob16M)
TD(u, Blob128M) //CORALCOOL-3025
TD(s, ValidityKey)
TD(t, ChannelId)
#undef TD
......@@ -501,6 +502,7 @@ INST_COOL_TYPEDEFS_HELPER(o, String64k);
INST_COOL_TYPEDEFS_HELPER(p, String16M);
INST_COOL_TYPEDEFS_HELPER(q, Blob64k);
INST_COOL_TYPEDEFS_HELPER(r, Blob16M);
INST_COOL_TYPEDEFS_HELPER(u, Blob128M); //CORALCOOL-3025
INST_COOL_TYPEDEFS_HELPER(s, ValidityKey);
INST_COOL_TYPEDEFS_HELPER(t, ChannelId);
......
......@@ -45,7 +45,7 @@ def _guess_cool_type_aliases():
# not working after ROOT 6.18 ROOT-10217, CORALCOOL-3040
#dirTypedefs = dir(getattr(cppyy.gbl,"cool::PyCool::Helpers::Typedefs"))
# Workaround because Pyroot doesn't have this information anymore
dirTypedefs = ['__add__', '__assign__', '__bool__', '__class__', '__cppname__', '__delattr__', '__destruct__', '__dict__', '__dispatch__', '__div__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__nonzero__', '__radd__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__rsub__', '__scope__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__weakref__', '_get_smart_ptr', 'functiona', 'functiona<bool>', 'functionb', 'functionb<unsigned char>', 'functiond', 'functiond<short>', 'functione', 'functione<unsigned short>', 'functionf', 'functionf<int>', 'functiong', 'functiong<unsigned int>', 'functionh', 'functionh<unsigned long long>', 'functioni', 'functioni<long long>', 'functionj', 'functionj<unsigned long long>', 'functionk', 'functionk<float>', 'functionl', 'functionl<double>', 'functionm', 'functionm<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionn', 'functionn<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functiono', 'functiono<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionp', 'functionp<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionq', 'functionq<coral::Blob>', 'functionr', 'functionr<coral::Blob>', 'functions', 'functions<unsigned long long>', 'functiont', 'functiont<unsigned int>', 'type_id_a__Bool', 'type_id_b__UChar', 'type_id_d__Int16', 'type_id_e__UInt16', 'type_id_f__Int32', 'type_id_g__UInt32', 'type_id_h__UInt63', 'type_id_i__Int64', 'type_id_j__UInt64', 'type_id_k__Float', 'type_id_l__Double', 'type_id_m__String255', 'type_id_n__String4k', 'type_id_o__String64k', 'type_id_p__String16M', 'type_id_q__Blob64k', 'type_id_r__Blob16M', 'type_id_s__ValidityKey', 'type_id_t__ChannelId']
dirTypedefs = ['__add__', '__assign__', '__bool__', '__class__', '__cppname__', '__delattr__', '__destruct__', '__dict__', '__dispatch__', '__div__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__nonzero__', '__radd__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__rsub__', '__scope__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__weakref__', '_get_smart_ptr', 'functiona', 'functiona<bool>', 'functionb', 'functionb<unsigned char>', 'functiond', 'functiond<short>', 'functione', 'functione<unsigned short>', 'functionf', 'functionf<int>', 'functiong', 'functiong<unsigned int>', 'functionh', 'functionh<unsigned long long>', 'functioni', 'functioni<long long>', 'functionj', 'functionj<unsigned long long>', 'functionk', 'functionk<float>', 'functionl', 'functionl<double>', 'functionm', 'functionm<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionn', 'functionn<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functiono', 'functiono<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionp', 'functionp<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionq', 'functionq<coral::Blob>', 'functionr', 'functionr<coral::Blob>', 'functions', 'functions<unsigned long long>', 'functiont', 'functiont<unsigned int>', 'type_id_a__Bool', 'type_id_b__UChar', 'type_id_d__Int16', 'type_id_e__UInt16', 'type_id_f__Int32', 'type_id_g__UInt32', 'type_id_h__UInt63', 'type_id_i__Int64', 'type_id_j__UInt64', 'type_id_k__Float', 'type_id_l__Double', 'type_id_m__String255', 'type_id_n__String4k', 'type_id_o__String64k', 'type_id_p__String16M', 'type_id_q__Blob64k', 'type_id_r__Blob16M', 'type_id_u__Blob128M', 'type_id_s__ValidityKey', 'type_id_t__ChannelId']
for k, v in extract_matches(re.compile(r"type_id_([a-z]*)__(\w*)"),
dirTypedefs):
id2typedef[k] = v
......
......@@ -495,6 +495,7 @@ def cool_Record():
"String16M": "std::string",
"Blob64k": "coral::Blob",
"Blob16M": "coral::Blob",
"Blob128M": "coral::Blob",
}
cpptype=cool_basic_types_mapping2[f.storageType().name()]
f.setValue[cpptype](value)
......
......@@ -45,7 +45,7 @@ def _guess_cool_type_aliases():
# not working after ROOT 6.18 ROOT-10217, CORALCOOL-3040
#dirTypedefs = dir(getattr(cppyy.gbl,"cool::PyCool::Helpers::Typedefs"))
# Workaround because Pyroot doesn't have this information anymore
dirTypedefs = ['__add__', '__assign__', '__bool__', '__class__', '__cppname__', '__delattr__', '__destruct__', '__dict__', '__dispatch__', '__div__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__nonzero__', '__radd__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__rsub__', '__scope__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__weakref__', '_get_smart_ptr', 'functiona', 'functiona<bool>', 'functionb', 'functionb<unsigned char>', 'functiond', 'functiond<short>', 'functione', 'functione<unsigned short>', 'functionf', 'functionf<int>', 'functiong', 'functiong<unsigned int>', 'functionh', 'functionh<unsigned long long>', 'functioni', 'functioni<long long>', 'functionj', 'functionj<unsigned long long>', 'functionk', 'functionk<float>', 'functionl', 'functionl<double>', 'functionm', 'functionm<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionn', 'functionn<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functiono', 'functiono<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionp', 'functionp<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionq', 'functionq<coral::Blob>', 'functionr', 'functionr<coral::Blob>', 'functions', 'functions<unsigned long long>', 'functiont', 'functiont<unsigned int>', 'type_id_a__Bool', 'type_id_b__UChar', 'type_id_d__Int16', 'type_id_e__UInt16', 'type_id_f__Int32', 'type_id_g__UInt32', 'type_id_h__UInt63', 'type_id_i__Int64', 'type_id_j__UInt64', 'type_id_k__Float', 'type_id_l__Double', 'type_id_m__String255', 'type_id_n__String4k', 'type_id_o__String64k', 'type_id_p__String16M', 'type_id_q__Blob64k', 'type_id_r__Blob16M', 'type_id_s__ValidityKey', 'type_id_t__ChannelId']
dirTypedefs = ['__add__', '__assign__', '__bool__', '__class__', '__cppname__', '__delattr__', '__destruct__', '__dict__', '__dispatch__', '__div__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__nonzero__', '__radd__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__rsub__', '__scope__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__weakref__', '_get_smart_ptr', 'functiona', 'functiona<bool>', 'functionb', 'functionb<unsigned char>', 'functiond', 'functiond<short>', 'functione', 'functione<unsigned short>', 'functionf', 'functionf<int>', 'functiong', 'functiong<unsigned int>', 'functionh', 'functionh<unsigned long long>', 'functioni', 'functioni<long long>', 'functionj', 'functionj<unsigned long long>', 'functionk', 'functionk<float>', 'functionl', 'functionl<double>', 'functionm', 'functionm<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionn', 'functionn<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functiono', 'functiono<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionp', 'functionp<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', 'functionq', 'functionq<coral::Blob>', 'functionr', 'functionr<coral::Blob>', 'functions', 'functions<unsigned long long>', 'functiont', 'functiont<unsigned int>', 'type_id_a__Bool', 'type_id_b__UChar', 'type_id_d__Int16', 'type_id_e__UInt16', 'type_id_f__Int32', 'type_id_g__UInt32', 'type_id_h__UInt63', 'type_id_i__Int64', 'type_id_j__UInt64', 'type_id_k__Float', 'type_id_l__Double', 'type_id_m__String255', 'type_id_n__String4k', 'type_id_o__String64k', 'type_id_p__String16M', 'type_id_q__Blob64k', 'type_id_r__Blob16M', 'type_id_u__Blob128M', 'type_id_s__ValidityKey', 'type_id_t__ChannelId']
for k, v in extract_matches(re.compile(r"type_id_([a-z]*)__(\w*)"),
dirTypedefs):
id2typedef[k] = v
......
......@@ -527,6 +527,7 @@ def cool_Record():
"String16M": "std::string",
"Blob64k": "coral::Blob",
"Blob16M": "coral::Blob",
"Blob128M": "coral::Blob",
}
cpptype=cool_basic_types_mapping2[f.storageType().name()]
f.setValue[cpptype](value)
......
......@@ -127,6 +127,7 @@ namespace rbug
case StorageType4::TypeId::String16M: return "String16M";
case StorageType4::TypeId::Blob64k: return "Blob64k";
case StorageType4::TypeId::Blob16M: return "Blob16M";
case StorageType4::TypeId::Blob128M: return "Blob128M";
}
std::stringstream out;
out << "PANIC! Unknown type '" << m_id << "' in StorageType4::name()";
......@@ -152,6 +153,7 @@ namespace rbug
case StorageType4::TypeId::String16M: return typeid( rbug::String16M );
case StorageType4::TypeId::Blob64k: return typeid( rbug::Blob64k );
case StorageType4::TypeId::Blob16M: return typeid( rbug::Blob16M );
case StorageType4::TypeId::Blob128M: return typeid( rbug::Blob128M );
}
std::stringstream out;
out << "PANIC! Unknown type '" << m_id << "' in StorageType4::cppType()";
......@@ -193,6 +195,8 @@ namespace rbug
{ static const StorageType4 type( id ); return type; }
case StorageType4::TypeId::Blob16M:
{ static const StorageType4 type( id ); return type; }
case StorageType4::TypeId::Blob128M:
{ static const StorageType4 type( id ); return type; }
}
std::stringstream out;
out << "PANIC! Unknown type '" << id << "' in StorageType4::storageType()";
......
......@@ -42,6 +42,7 @@ namespace rbug
typedef std::string String16M;
typedef Blob4 Blob64k;
typedef Blob4 Blob16M;
typedef Blob4 Blob128M;
const SChar SCharMin = SCHAR_MIN; // -127
const SChar SCharMax = SCHAR_MAX; // +128
......@@ -69,7 +70,7 @@ namespace rbug
public:
enum TypeId { Bool, UChar, Int16, UInt16, Int32, UInt32, UInt63, Int64,
Float, Double, String255, String4k, String64k, String16M,
Blob64k, Blob16M };
Blob64k, Blob16M, Blob128M };
public:
virtual ~StorageType4() {}
static const StorageType4& storageType( const TypeId& id );
......
......@@ -416,6 +416,10 @@ class TestIFolder( unittest.TestCase ):
cool.StorageType.Blob16M,
cool.FieldSelection.EQ,
cool.Blob16M(10))
fs = cool.FieldSelection("i",
cool.StorageType.Blob128M,
cool.FieldSelection.EQ,
cool.Blob128M(10))
# test payload queries (move to different test?)
def test_fieldSelection_nullness(self):
......@@ -470,6 +474,9 @@ class TestIFolder( unittest.TestCase ):
fs = cool.FieldSelection("i",
cool.StorageType.Blob16M,
cool.FieldSelection.IS_NULL)
fs = cool.FieldSelection("i",
cool.StorageType.Blob128M,
cool.FieldSelection.IS_NULL)
# instantiate CompositeSelections
......
......@@ -27,7 +27,8 @@ class TestRecordSpecification( unittest.TestCase ):
"String64k",
"String16M",
"Blob64k",
"Blob16M" ] :
"Blob16M",
"Blob128M" ] :
self.all_types[t] = getattr(cool.StorageType,t)
self.spec = cool.RecordSpecification()
self.spec.extend("I",cool.StorageType.Int32)
......
......@@ -21,6 +21,11 @@ class TestBlob( unittest.TestCase ):
self.assert_(cool.Blob16M == coral.Blob)
self.assert_(dir(cool.Blob16M) == dir(coral.Blob))
def _test_007_typedef(self):
"""Check cool.Blob128M typedef"""
self.assert_(cool.Blob128M == coral.Blob)
self.assert_(dir(cool.Blob128M) == dir(coral.Blob))
def test_010_init(self):
"""Initialization"""
blob = coral.Blob()
......
......@@ -416,6 +416,10 @@ class TestIFolder( unittest.TestCase ):
cool.StorageType.Blob16M,
cool.FieldSelection.EQ,
cool.Blob16M(10))
fs = cool.FieldSelection("i",
cool.StorageType.Blob128M,
cool.FieldSelection.EQ,
cool.Blob128M(10))
# test payload queries (move to different test?)
def test_fieldSelection_nullness(self):
......@@ -470,6 +474,9 @@ class TestIFolder( unittest.TestCase ):
fs = cool.FieldSelection("i",
cool.StorageType.Blob16M,
cool.FieldSelection.IS_NULL)
fs = cool.FieldSelection("i",
cool.StorageType.Blob128M,
cool.FieldSelection.IS_NULL)
# instantiate CompositeSelections
......
......@@ -27,7 +27,8 @@ class TestRecordSpecification( unittest.TestCase ):
"String64k",
"String16M",
"Blob64k",
"Blob16M" ] :
"Blob16M",
"Blob128M" ] :
self.all_types[t] = getattr(cool.StorageType,t)
self.spec = cool.RecordSpecification()
self.spec.extend("I",cool.StorageType.Int32)
......
......@@ -21,6 +21,11 @@ class TestBlob( unittest.TestCase ):
self.assertTrue(cool.Blob16M == coral.Blob)
self.assertTrue(dir(cool.Blob16M) == dir(coral.Blob))
def _test_007_typedef(self):
"""Check cool.Blob128M typedef"""
self.assertTrue(cool.Blob128M == coral.Blob)
self.assertTrue(dir(cool.Blob128M) == dir(coral.Blob))
def test_010_init(self):
"""Initialization"""
blob = coral.Blob()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment