Factory.h File Reference

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include "PhysicsNtuple/Handle.h"

Go to the source code of this file.

Classes

class  Anp::Factory< T >

Namespaces

namespace  Anp
 

Handle class template - a simplified version of boost::intrusive_ptr.


Defines

#define REGISTER_ANP_OBJECT(BASE, CLASS)
#define REGISTER_ANY_OBJECT(PREF, BASE, CLASS)

Define Documentation

#define REGISTER_ANP_OBJECT ( BASE,
CLASS   ) 
Value:
namespace                                                               \
   {                                                                    \
      Anp::Handle<Anp::BASE> Create##BASE()                             \
      {                                                                 \
         return Anp::Handle<Anp::BASE>(new Anp::CLASS);                 \
      }                                                                 \
      bool Registered##BASE = Anp::Factory<Anp::BASE>::Instance().      \
         Register(#CLASS, Create##BASE);                                \
   }

REGISTER_ANP_OBJECT(BaseClass,MyClass)

expands to this code:

namespace { Anp::Handle<Anp::BaseClass> CreateBaseClass() { return Anp::Handle<Anp::BaseClass>(new Anp::MyClass); } bool RegisteredBaseClass = Anp::Factory<Anp::BaseClass>::Instance(). Register("MyClass", CreateBaseClass); }

Definition at line 105 of file Factory.h.

#define REGISTER_ANY_OBJECT ( PREF,
BASE,
CLASS   ) 
Value:
namespace                                                               \
   {                                                                    \
      Anp::Handle<PREF::BASE> Create##PREF##BASE()                      \
      {                                                                 \
         return Anp::Handle<PREF::BASE>(new PREF::CLASS);               \
      }                                                                 \
      bool Registered##BASE = Anp::Factory<PREF::BASE>::Instance().     \
         Register(#CLASS, Create##PREF##BASE);                          \
   }

Definition at line 116 of file Factory.h.


Generated on 22 Nov 2017 for loon by  doxygen 1.6.1