#include <AbsPtr.h>
|
static X * | copy (const X *f) |
|
template<class X>
class StandardCopyDefinition< X >
Definition at line 351 of file AbsPtr.h.
◆ copy()
Definition at line 353 of file AbsPtr.h.
353 {
354#ifdef DEBUG_ACTIVEPTR
355 mcout <<
"static X* StandardCopyDefinition::copy(const X* f)\n";
356#endif
357
358
359#ifndef COPY_TYPE_CHECK
360#ifndef COPY_RETURNS_COMMON_BASE
361 return f->copy();
362#else
363 X* ptr = dynamic_cast<X*>(f->copy());
364 if (ptr == NULL) {
365 mcerr <<
"Error in X* StandardCopyDefinition::copy(const X* f): "
366 << "cannot convert pointer returned from f->copy()"
367 << "to type " << typeid(X).name() << '\n';
368 }
369 return ptr;
370#endif
371#else
372
373
374
375
376 X* p = f->copy();
377
378
379
380
381
382
383
384
385
386#ifdef DEBUG_ACTIVEPTR
387 mcout <<
"X* StandardCopyDefinition::copy(const X* f): f->copy() returned "
388 << p << '\n';
389 mcerr <<
"Type of X is (in internal notations) " <<
typeid(X).name()
390 << '\n';
391 mcerr <<
"Type of *p is (in internal notations) " <<
typeid(*p).name()
392 << '\n';
393#endif
394 if (typeid(*p) != typeid(*f)) {
395 mcerr <<
"Error in X* StandardCopyDefinition::copy(const X* f): "
396 << "typeid(*p) != typeid(*f) \n";
397 mcerr <<
"Type of X is (in internal notations) " <<
typeid(X).name()
398 << '\n';
399 mcerr <<
"Type of *p is (in internal notations) " <<
typeid(*p).name()
400 << '\n';
401 mcerr <<
"Type of *f is (in internal notations) " <<
typeid(*f).name()
402 << '\n';
403 mcerr <<
"Possible reason is omiting of copy function in one of the "
404 "derivative classes\n";
406 }
407 return p;
408#endif
409 }
The documentation for this class was generated from the following file: