summaryrefslogtreecommitdiffstats
path: root/engine/include/collector.hpp
blob: 45a3e74fe775b4dff298128d022877a7db40afb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __FLATCOLLECTOR_H__
#define __FLATCOLLECTOR_H__

#include "object.hpp"
#include <set>

namespace flat {

class FlatCollector : virtual public flat::object
{
    FlatCollector * parent;

    bool released;

    std::set<FlatCollector*> children;

public:

    FlatCollector(FlatCollector *parent = 0);

    virtual ~FlatCollector();

    /* Ownership functions */

    bool isReleased() const;

    /* Release object from automatic ownership destruction */
    void release();
    
    void attach(FlatCollector*);
    void detach(FlatCollector*);

    void setParent(FlatCollector*);
    void releaseParent();

    FlatCollector * getParent();

    bool isParentOf(FlatCollector*) const;

    std::set<FlatCollector*>::iterator begin();
    std::set<FlatCollector*>::iterator end();

    std::set<FlatCollector*>::const_iterator begin() const;
    std::set<FlatCollector*>::const_iterator end() const;
};

}

#endif