Compare objects.
157 {
159
161 second.is_valid()) {
162
163 const_iterator i1 = this->find(first .getTypename());
164 const_iterator i2 = this->find(second.getTypename());
165
166 if (i1 != this->end() &&
167 i2 != this->end() &&
168 i1 == i2) {
169
170 if (!i1->second->equals(first.getAddress(), second.getAddress())) {
171 return false;
172 }
173
174 } else if (first .getClass() != NULL &&
175 second.getClass() != NULL) {
176
177 if (first .getClass()->GetCollectionType() != ROOT::ESTLType::kNotSTL && first .getClass()->GetCollectionProxy() != NULL &&
178 second.getClass()->GetCollectionType() != ROOT::ESTLType::kNotSTL && second.getClass()->GetCollectionProxy() != NULL) {
179
180 std::unique_ptr<TVirtualCollectionProxy>
p1(first .getClass()->GetCollectionProxy()->Generate());
181 std::unique_ptr<TVirtualCollectionProxy> p2(second.getClass()->GetCollectionProxy()->Generate());
182
183 p1->PushProxy(
const_cast<char*
>(first .getAddress()));
184 p2->PushProxy(const_cast<char*>(second.getAddress()));
185
186 TDictionary* d1 = TDictionary::GetDictionary(
p1->GetType() == EDataType::kNoType_t ?
p1->GetValueClass()->GetName() : TDataType::GetTypeName(
p1->GetType()));
187 TDictionary* d2 = TDictionary::GetDictionary(p2->GetType() == EDataType::kNoType_t ? p2->GetValueClass()->GetName() : TDataType::GetTypeName(p2->GetType()));
188
189 DEBUG(
"proxy: " <<
p1->GetCollectionClass()->GetName() <<
" " << d1->GetName() <<
"(" <<
p1->Size() <<
");" << endl);
190 DEBUG(
"proxy: " << p2->GetCollectionClass()->GetName() <<
" " << d2->GetName() <<
"(" << p2->Size() <<
");" << endl);
191
192 if (
p1->Size() != p2->Size()) {
193 return false;
194 }
195
196 for (UInt_t i = 0; (i !=
p1->Size() &&
197 i != p2->Size()); ++i) {
198
199 DEBUG(
"index: " << d1->GetName() <<
"[" << i <<
"] " << endl);
200
201
202 const JRootWritableClass w1(d1, (
char*)
p1->At(i));
203 const JRootWritableClass w2(d2, (char*) p2->At(i));
204
206 return false;
207 }
208 }
209
210 } else {
211
212 if (first .getClass()->GetListOfBases() != NULL &&
213 second.getClass()->GetListOfBases() != NULL) {
214
215 std::unique_ptr<TIterator> i1(first .getClass()->GetListOfBases()->MakeIterator());
216 std::unique_ptr<TIterator> i2(second.getClass()->GetListOfBases()->MakeIterator());
217
218 for (
const TBaseClass *
p1, *p2; ((
p1 = (
const TBaseClass*) i1->Next()) != NULL &&
219 (p2 = (const TBaseClass*) i2->Next()) != NULL); ) {
220
223
224 DEBUG(
"base: " <<
p1->GetName() << endl);
225
226
227 if (!this->
compare(first.get(*
p1), second.get(*p2))) {
228 return false;
229 }
230 }
231 }
232 }
233
234 if (first .getClass()->GetListOfDataMembers() != NULL &&
235 second.getClass()->GetListOfDataMembers() != NULL) {
236
237 std::unique_ptr<TIterator> i1(first .getClass()->GetListOfDataMembers()->MakeIterator());
238 std::unique_ptr<TIterator> i2(second.getClass()->GetListOfDataMembers()->MakeIterator());
239
240 for (
const TDataMember *
p1, *p2; ((
p1 = (
const TDataMember*) i1->Next()) != NULL &&
241 (p2 = (const TDataMember*) i2->Next()) != NULL); ) {
242
243
246
247 DEBUG(
"member: " <<
p1->GetTrueTypeName() <<
" " <<
p1->GetName() <<
";" << endl);
248
249
250 if (!this->
compare(first.get(*
p1), second.get(*p2))) {
251 return false;
252 }
253 }
254 }
255 }
256 }
257 }
258 }
259
260 return true;
261 }
bool is_valid(const json &js)
Check validity of JSon data.
static bool is_class(const char *const name)
Check name of class against internal ROOT class names.