/* vim: set ts=4 sw=4 tw=99 et:
 *
 * Copyright (C) 2004-2012 David Anderson
 *
 * This file is part of SourcePawn.
 *
 * SourcePawn is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 * 
 * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * SourcePawn. If not, see http://www.gnu.org/licenses/.
 */
#ifndef _include_ke_global_roots_h_
#define _include_ke_global_roots_h_

#include "Utility.h"
#include "Handles.h"
#include "InlineList.h"
#include "VirtualObjectVisitor.h"

namespace ke {

class Zone;
class Object;

class HeapRoot : public InlineListNode<HeapRoot>
{
  public:
    Object *obj;
};

class GlobalRoots
{
    Zone *zone_;

  public:
    GlobalRoots(Zone *zone);
    ~GlobalRoots();

    bool initialize();

    HeapRoot *create();
    void destroy(HeapRoot *root);

    void accept(VirtualObjectVisitor *visitor);

  private:
    InlineList<HeapRoot> roots_;
};

}

#endif // _include_ke_global_roots_h_
