~ubuntu-branches/ubuntu/oneiric/mpqc/oneiric

« back to all changes in this revision

Viewing changes to src/lib/util/class/class.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2005-11-27 11:41:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127114149-zgz9r3gk50w8ww2q
Tags: 2.3.0-1
* New upstream release.
* debian/rules (SONAME): Activate awk snippet for automatic so-name
  detection again, resulting in a bump to `7' and making a `c2a' for
  the C++ allocator change unnecessary; closes: #339232.
* debian/patches/00list (08_gcc-4.0_fixes): Removed, no longer needed.
* debian/rules (test): Remove workarounds, do not abort build if tests
  fail.
* debian/ref: Removed.
* debian/control.in (libsc): Added Conflict against libsc6c2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include <util/misc/formio.h>
45
45
 
46
46
#include <util/class/class.h>
 
47
#include <util/class/proxy.h>
47
48
 
48
49
using namespace std;
49
50
using namespace sc;
55
56
 
56
57
/////////////////////////////////////////////////////////////////
57
58
 
 
59
static sc::ClassDesc DescribedClassProxy_cd(
 
60
    typeid(sc::DescribedClassProxy), "DescribedClassProxy",1,"public DescribedClass");
 
61
 
 
62
/////////////////////////////////////////////////////////////////
 
63
 
58
64
ParentClass::ParentClass(ClassDesc*classdesc,Access access,int is_virtual):
59
65
  _access(access),
60
66
  _is_virtual(is_virtual),
232
238
      abort();
233
239
    }
234
240
  else {
235
 
      (*type_info_all_)[key] = this;
 
241
      if (type_info_all_->find(key) == type_info_all_->end()) {
 
242
          (*type_info_all_)[key] = this;
 
243
        }
 
244
      else {
 
245
          // this should never happen
 
246
        }
236
247
    }
237
248
 
238
249
  // test the version number to see if it is valid
241
252
      exit(1);
242
253
    }
243
254
 
244
 
  init(name,version,parents,ctor,keyvalctor,stateinctor);
 
255
  init(name,version,parents,&ti,ctor,keyvalctor,stateinctor);
245
256
}
246
257
 
247
258
ClassDesc::ClassDesc(const char* name)
252
263
void
253
264
ClassDesc::init(const char* name, int version,
254
265
                const char* parents,
 
266
                const type_info *ti,
255
267
                DescribedClass* (*ctor)(),
256
268
                DescribedClass* (*keyvalctor)(const Ref<KeyVal>&),
257
269
                DescribedClass* (*stateinctor)(StateIn&))
262
274
  ctor_ = ctor;
263
275
  keyvalctor_ = keyvalctor;
264
276
  stateinctor_ = stateinctor;
 
277
  ti_ = ti;
265
278
 
266
279
  // make sure that the static members have been initialized
267
280
  if (!all_) {
362
375
  // delete this ClassDesc from the list of all ClassDesc's
363
376
  std::string key(classname_);
364
377
  all_->erase(key);
 
378
 
365
379
  // if the list of all ClassDesc's is empty, delete it
366
380
  if (all_->size() == 0) {
367
381
      delete all_;
370
384
      classlib_search_path_ = 0;
371
385
    }
372
386
 
 
387
  // delete this ClassDesc entry from the type_info map
 
388
  if (ti_ != 0) {
 
389
      type_info_key key(ti_);
 
390
      type_info_all_->erase(key);
 
391
      if (type_info_all_->size() == 0) {
 
392
          delete type_info_all_;
 
393
          type_info_all_ = 0;
 
394
        }
 
395
    }
 
396
 
373
397
  // delete local data
374
398
  delete[] classname_;
375
399
  if (children_) delete children_;
603
627
}
604
628
 
605
629
ClassDesc*
606
 
DescribedClass::class_desc() const
 
630
DescribedClass::class_desc() const throw()
607
631
{
608
 
  return ClassDesc::class_desc(typeid(*this));
 
632
  ClassDesc *cd;
 
633
  try {
 
634
      cd = ClassDesc::class_desc(typeid(*this));
 
635
    }
 
636
  catch (...) {
 
637
      cd = 0;
 
638
    }
 
639
  return cd;
609
640
}
610
641
 
611
642
const char* DescribedClass::class_name() const