summaryrefslogtreecommitdiff
path: root/include/gras/weak_container.hpp
blob: e2bc5605ed22ee305199ecc710669897c6f9b1d3 (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
// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.

#ifndef INCLUDED_GRAS_WEAK_CONTAINER_HPP
#define INCLUDED_GRAS_WEAK_CONTAINER_HPP

#include <gras/gras.hpp>
#include <boost/shared_ptr.hpp>

namespace gras
{

    /*!
     * Weak Container interface class:
     * A weak container is an object with a method called lock.
     * Lock gets a reference to an object's parent container.
     * The weak container itself does not actually hold a reference.
     * This container class is shared_ptr, a Pyobject, anything.
     */
    struct GRAS_API WeakContainer
    {
        WeakContainer(void);

        virtual ~WeakContainer(void);

        //! Lock creates a shared pointer holding a container reference
        virtual boost::shared_ptr<const void> lock(void) = 0;
    };

} //namespace gras

#endif /*INCLUDED_GRAS_WEAK_CONTAINER_HPP*/