CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MemberWithDict.cc
Go to the documentation of this file.
2 
5 #include <ostream>
6 #include <sstream>
7 
8 namespace edm {
9 
10  MemberWithDict::MemberWithDict() : dataMember_(nullptr) {}
11 
12  MemberWithDict::MemberWithDict(TDataMember* dataMember) : dataMember_(dataMember) {}
13 
14  MemberWithDict::operator bool() const { return dataMember_ != nullptr; }
15 
16  std::string MemberWithDict::name() const { return dataMember_->GetName(); }
17 
19  if (isArray()) {
20  std::ostringstream name;
21  name << dataMember_->GetTrueTypeName();
22  for (int i = 0; i < dataMember_->GetArrayDim(); ++i) {
23  name << '[';
24  name << dataMember_->GetMaxIndex(i);
25  name << ']';
26  }
27  return TypeWithDict::byName(name.str());
28  }
29  return TypeWithDict::byName(dataMember_->GetTrueTypeName());
30  }
31 
33 
34  bool MemberWithDict::isArray() const { return dataMember_->Property() & kIsArray; }
35 
36  bool MemberWithDict::isConst() const { return dataMember_->Property() & kIsConstant; }
37 
38  bool MemberWithDict::isPublic() const { return dataMember_->Property() & kIsPublic; }
39 
40  bool MemberWithDict::isStatic() const { return dataMember_->Property() & kIsStatic; }
41 
42  bool MemberWithDict::isTransient() const { return !dataMember_->IsPersistent(); }
43 
44  size_t MemberWithDict::offset() const { return dataMember_->GetOffset(); }
45 
47  return ObjectWithDict(typeOf(), reinterpret_cast<void*>(dataMember_->GetOffset()));
48  }
49 
51  return ObjectWithDict(typeOf(), reinterpret_cast<char*>(obj.address()) + dataMember_->GetOffset());
52  }
53 
54 } // namespace edm
void * address() const
bool isStatic() const
size_t offset() const
bool isArray() const
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
bool isPublic() const
TypeWithDict declaringType() const
TDataMember * dataMember_
std::string name() const
ObjectWithDict get() const
TypeWithDict typeOf() const
bool isConst() const
bool isTransient() const