Compare objects.
133 {
135
137 second.is_valid()) {
138
139 const_iterator i1 = this->find(first .getTypename());
140 const_iterator i2 = this->find(second.getTypename());
141
142 if (i1 != this->end() &&
143 i2 != this->end() &&
144 i1 == i2) {
145
146 if (!i1->second->equals(first.getAddress(), second.getAddress())) {
147 return false;
148 }
149
150 } else if (first .getClass() != NULL &&
151 second.getClass() != NULL) {
152
153 if (first .getClass()->GetCollectionType() != ROOT::ESTLType::kNotSTL && first .getClass()->GetCollectionProxy() != NULL &&
154 second.getClass()->GetCollectionType() != ROOT::ESTLType::kNotSTL && second.getClass()->GetCollectionProxy() != NULL) {
155
156 std::unique_ptr<TVirtualCollectionProxy>
p1(first .getClass()->GetCollectionProxy()->Generate());
157 std::unique_ptr<TVirtualCollectionProxy> p2(second.getClass()->GetCollectionProxy()->Generate());
158
159 p1->PushProxy(
const_cast<char*
>(first .getAddress()));
160 p2->PushProxy(const_cast<char*>(second.getAddress()));
161
162 TDictionary* d1 = TDictionary::GetDictionary(
p1->GetType() == EDataType::kNoType_t ?
p1->GetValueClass()->GetName() : TDataType::GetTypeName(
p1->GetType()));
163 TDictionary* d2 = TDictionary::GetDictionary(p2->GetType() == EDataType::kNoType_t ? p2->GetValueClass()->GetName() : TDataType::GetTypeName(p2->GetType()));
164
165 DEBUG(
"proxy: " <<
p1->GetCollectionClass()->GetName() <<
" " << d1->GetName() <<
"(" <<
p1->Size() <<
");" << endl);
166 DEBUG(
"proxy: " << p2->GetCollectionClass()->GetName() <<
" " << d2->GetName() <<
"(" << p2->Size() <<
");" << endl);
167
168 if (
p1->Size() != p2->Size()) {
169 return false;
170 }
171
172 for (UInt_t i = 0; (i !=
p1->Size() &&
173 i != p2->Size()); ++i) {
174
175 DEBUG(
"index: " << d1->GetName() <<
"[" << i <<
"] " << endl);
176
177
178 const JRootWritableClass w1(d1, (
char*)
p1->At(i));
179 const JRootWritableClass w2(d2, (char*) p2->At(i));
180
182 return false;
183 }
184 }
185
186 } else {
187
188 if (first .getClass()->GetListOfBases() != NULL &&
189 second.getClass()->GetListOfBases() != NULL) {
190
191 std::unique_ptr<TIterator> i1(first .getClass()->GetListOfBases()->MakeIterator());
192 std::unique_ptr<TIterator> i2(second.getClass()->GetListOfBases()->MakeIterator());
193
194 for (
const TBaseClass *
p1, *p2; ((
p1 = (
const TBaseClass*) i1->Next()) != NULL &&
195 (p2 = (const TBaseClass*) i2->Next()) != NULL); ) {
196
199
200 DEBUG(
"base: " <<
p1->GetName() << endl);
201
202
203 if (!this->
compare(first.get(*
p1), second.get(*p2))) {
204 return false;
205 }
206 }
207 }
208 }
209
210 if (first .getClass()->GetListOfDataMembers() != NULL &&
211 second.getClass()->GetListOfDataMembers() != NULL) {
212
213 std::unique_ptr<TIterator> i1(first .getClass()->GetListOfDataMembers()->MakeIterator());
214 std::unique_ptr<TIterator> i2(second.getClass()->GetListOfDataMembers()->MakeIterator());
215
216 for (
const TDataMember *
p1, *p2; ((
p1 = (
const TDataMember*) i1->Next()) != NULL &&
217 (p2 = (const TDataMember*) i2->Next()) != NULL); ) {
218
219
222
223 DEBUG(
"member: " <<
p1->GetTrueTypeName() <<
" " <<
p1->GetName() <<
";" << endl);
224
225
226 if (!this->
compare(first.get(*
p1), second.get(*p2))) {
227 return false;
228 }
229 }
230 }
231 }
232 }
233 }
234 }
235
236 return true;
237 }
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.