Show proxy.h syntax highlighted
#ifndef __GEN_PROG_PLUGIN_PROXY_H__
#define __GEN_PROG_PLUGIN_PROXY_H__ 1
#include <gen_prog/plugin/registry.h>
#include <gen_prog/plugin/detail/thread_locker.h>
#include <gen_prog/plugin/detail/singleton.h>
#include <iostream>
namespace gen_prog
{
namespace plugin
{
// namespace detail
// {
// template < class protected_type , class friend_type >
// struct protected_inserter : public protected_type
// {
// template < typename T >
// struct identity
// {
// typedef T type;
// };
//
// friend class identity< friend_type >::type;
// };
// }
/* registry_proxy is a proxy to registre data in the registry
* @\param D the type to registre
* @\param R the registry where registre the type must implemente the following function
*
*/
template < typename D, typename R /*= registry< typename D::base_type >*/ >
class proxy
{
typedef D derived_type;
typedef R singleton_registry_type;
public:
proxy()
: _derived(new derived_type)
{
//detail::protected_inserter< registry_type, self_type > * unprotectedRegistry = registry_accessor_type::instance();
//unprotectedRegistry->reg(_derived.get());
singleton_registry_type::instance()->reg(_derived.get());
}
~proxy()
{
//detail::protected_inserter< registry_type, self_type > * unprotectedRegistry = registry_accessor_type::instance();
//unprotectedRegistry->reg(_derived.get());
singleton_registry_type::instance()->unreg(_derived.get());
}
private:
osg::ref_ptr< derived_type > _derived;
};
}
}
#endif // ** __GEN_PROG_PLUGIN_PROXY_H__ ** //
See more files for this project here