// edm_tregelem.h #ifndef INCLUDED_EDM_TREGELEM #define INCLUDED_EDM_TREGELEM // PURPOSE // Provide a parameterizable implementation of the edm_RegElem protocol. // // CLASSES // edm_TypedRegElem: Template class. Implementation of edm_RegElem that // allows users to specialize it through parameterization. // // More comments need to go here! #ifndef INCLUDED_EDM_REGISTRY #include "edm_registry.h" #endif #ifndef INCLUDED_EDM_CHUNK #include "edm_chunk.h" #endif #ifndef INCLUDED_AUTO_PTR #include // Should be #define INCLUDED_AUTO_PTR #endif #ifndef INCLUDED_TYPEINFO #include #define INCLUDED_TYPEINFO #endif // ====================== // CLASS edm_TypedRegElem // ====================== template class edm_TypedRegElem : public edm_RegElem { public: // CREATORS ~edm_TypedRegElem() {} // ACCESSORS void clone(auto_ptr *handle) const; // Create a dynamically allocated copy of this registry element and // load it in the handle provided. The behavior is undefined if handle // is 0. { *handle = auto_ptr(new edm_TypedRegElem(*this)); } void createChunk(auto_ptr *handle) const; // Create a dynamically allocated chunk object of type T and load it in // the handle provided. The behavior is undefined if handle is 0. { *handle = auto_ptr(new T); } bool isA(const edm_Chunk& chunk) const // Return true if the specified reconstructor is of type T. { return dynamic_cast((edm_Chunk*)&chunk) ? true : false; } const char * className() const // Return the class name of T. // NOTE: This name cannot be used for a persistent identification. The // name is non-portable and can change across program executions. { return typeid(T).name(); } }; #endif