Synopsis - Cross-Reference

File: /Synopsis/Parsers/Cxx/FakeGC.hh
 1//
 2// Copyright (C) 2001 Stephen Davies
 3// Copyright (C) 2001 Stefan Seefeld
 4// All rights reserved.
 5// Licensed to the public under the terms of the GNU LGPL (>= 2),
 6// see the file COPYING for details.
 7//
 8
 9#ifndef FakeGC_hh_
10#define FakeGC_hh_
11
12//. The fake Garbage Collector namespace
13namespace FakeGC
14{
15
16// Provide a very simple garbage collection mechanism:
17// All objects of this type are assumed to be heap-allocated.
18// During construction they build up a single-linked list, and once
19// the program is finished, the whole list is taken down by deleting
20// the first node.
21struct LightObject
22{
23  LightObject() : next(head) { LightObject::head = this;}
24  virtual ~LightObject() { delete next;}
25
26  LightObject *next;
27  static LightObject *head;
28};
29
30} // namespace FakeGC
31
32#endif