24 #ifndef __DOTS_INTERNAL_BLOB_READER_H__
25 #define __DOTS_INTERNAL_BLOB_READER_H__
31 #include <Safir/Dob/Typesystem/ToolSupport/Internal/InternalDefs.h>
32 #include <Safir/Dob/Typesystem/ToolSupport/Internal/Blob.h>
63 template <
class RepositoryT,
class Traits=Safir::Dob::Typesystem::ToolSupport::TypeRepositoryTraits<RepositoryT> >
83 static DotsC_Int32
GetSize(
const char* blob) {
return Internal::Blob::GetSize(blob);}
100 ,m_classDescription(rep->GetClass(m_blob.
TypeId()))
101 ,m_memberDescription(NULL)
110 DotsC_Int32
Size()
const {
return m_blob.Size();}
116 DotsC_TypeId
TypeId()
const {
return m_blob.TypeId();}
126 return m_blob.IsChangedTopLevel(member);
134 int NumberOfValues(DotsC_MemberIndex member)
const {
return m_blob.NumberOfValues(member);}
143 void ReadStatus(DotsC_MemberIndex member,
int valueIndex,
bool& isNull,
bool& isChanged)
const
145 MoveToMember(member);
146 m_blob.ValueStatus(member, valueIndex, isNull, isChanged);
158 Key
ReadKey(DotsC_MemberIndex member,
int valueIndex)
const
160 MoveToMember(member);
161 if (m_memberDescription->GetCollectionType()!=DictionaryCollectionType)
163 ThrowWrongCollectionType();
165 return Internal::BlobUtils::Reader<Key>::Key(m_blob, member, valueIndex);
178 void ReadValue(DotsC_MemberIndex member,
int valueIndex, Val& val,
bool& isNull,
bool& isChanged)
const
180 MoveToMember(member);
181 m_blob.ValueStatus(member, valueIndex, isNull, isChanged);
184 val=Internal::BlobUtils::Reader<Val>::Value(m_blob, member, valueIndex);
189 const RepositoryType* m_repository;
190 Safir::Dob::Typesystem::ToolSupport::Internal::Blob m_blob;
191 const ClassDescriptionType* m_classDescription;
192 mutable const MemberDescriptionType* m_memberDescription;
193 mutable DotsC_MemberIndex m_memberIndex;
195 inline void MoveToMember(DotsC_MemberIndex member)
const
197 if (m_memberIndex!=member)
199 m_memberDescription=m_classDescription->GetMember(member);
200 m_memberIndex=member;
204 inline void ThrowWrongCollectionType()
const
206 std::ostringstream os;
207 os<<
"Trying to write data of wrong collection type to a blob for member '"<<m_memberDescription->GetName()<<
"' in class '"<<m_classDescription->GetName()<<
"'";
208 throw std::logic_error(os.str());
DotsC_TypeId TypeId
A unique type identifier.
Definition: Defs.h:218
This class is used to unpack and read blobs created by the BlobWriter class.
Definition: BlobReader.h:64
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition: Backdoor.h:30
Traits::CreateRoutineDescriptionType CreateRoutineDescriptionType
Definition: BlobReader.h:76
bool IsChangedTopLevel(DotsC_MemberIndex member) const
Check if the member is changed at top level.
Definition: BlobReader.h:124
Traits::ExceptionDescriptionType ExceptionDescriptionType
Definition: BlobReader.h:71
static DotsC_Int32 GetSize(const char *blob)
Static method.
Definition: BlobReader.h:83
DOTS_CPP_API Dob::Typesystem::TypeId GetTypeId(const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::MemberIndex member)
Get type id of object or enumeration member.
static DotsC_TypeId GetTypeId(const char *blob)
Static method.
Definition: BlobReader.h:90
Traits::EnumDescriptionType EnumDescriptionType
Definition: BlobReader.h:73
Traits::PropertyDescriptionType PropertyDescriptionType
Definition: BlobReader.h:70
Traits::ClassDescriptionType ClassDescriptionType
Definition: BlobReader.h:68
Traits::ParameterDescriptionType ParameterDescriptionType
Definition: BlobReader.h:72
DotsC_Int32 Size() const
Get the size of the blob.
Definition: BlobReader.h:110
int NumberOfValues(DotsC_MemberIndex member) const
Get the number of values for the member.
Definition: BlobReader.h:134
Traits::MemberMappingDescriptionType MemberMappingDescriptionType
Definition: BlobReader.h:74
Traits::PropertyMappingDescriptionType PropertyMappingDescriptionType
Definition: BlobReader.h:75
BlobReader(const RepositoryT *rep, const char *blob)
Constructor - Creates a reader object that unpacks the blob and makes it possible to read its content...
Definition: BlobReader.h:97
void ReadValue(DotsC_MemberIndex member, int valueIndex, Val &val, bool &isNull, bool &isChanged) const
Read the value element of a member value.
Definition: BlobReader.h:178
Traits::MemberDescriptionType MemberDescriptionType
Definition: BlobReader.h:69
void ReadStatus(DotsC_MemberIndex member, int valueIndex, bool &isNull, bool &isChanged) const
Convenience method for checking if a member is null.
Definition: BlobReader.h:143
Key ReadKey(DotsC_MemberIndex member, int valueIndex) const
Reads the key element of a member value.
Definition: BlobReader.h:158
friend struct Internal::BlobUtils::BlobAccess
Definition: BlobReader.h:211
Traits::RepositoryType RepositoryType
Definition: BlobReader.h:67
DotsC_TypeId TypeId() const
Get the type id of the blob.
Definition: BlobReader.h:116