// ANNA - Anna is Not Nothingness Anymore // // // // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // // // // See project site at http://redmine.teslayout.com/projects/anna-suite // // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // #ifndef anna_diameter_codec_tme_Engine_hpp #define anna_diameter_codec_tme_Engine_hpp // STL #include #include #include #include #include using namespace anna::diameter::codec::tme; //------------------------------------------------------------------------------ //---------------------------------------------------------------------- #define //------------------------------------------------------------------------------ namespace anna { namespace diameter { namespace codec { namespace tme { /** * Standard inheritance for engine component implementation, allocating basic Avp and Message classes. */ class Engine : public EngineImpl { public: /** Constructor @param className Logical name for the class. */ Engine(const char *className = "anna::diameter::codec::tme::Engine") : EngineImpl(className) {;} void releaseAvp(anna::diameter::codec::Avp* avp) { if(avp == NULL) return; Avp* aux = static_cast (avp); aux->clear(); // free internal data-part storage specially for grouped avps which will release its childrens a_avps.release(aux); } void releaseMessage(anna::diameter::codec::Message* message) { if(message == NULL) return; Message* aux = static_cast (message); aux->clear(); // free internal data-part storage specially for childrens releasing a_messages.release(aux); } protected: anna::Recycler a_avps; anna::Recycler a_messages; anna::diameter::codec::Avp* allocateAvp() { return a_avps.create(); } anna::diameter::codec::Message* allocateMessage() { return a_messages.create(); } friend class Message; friend class Avp; }; } } } } #endif