summaryrefslogtreecommitdiffstats
path: root/engine/include/collector.hpp
blob: 448dba9469d6a0f1070ee8bf65dc3c95c5b61824 (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
{
private:
    FlatCollector * m_parent;
    bool m_released;

    std::set<FlatCollector*> m_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