--- parser3/src/include/pa_stylesheet_manager.h 2001/10/29 08:23:49 1.2 +++ parser3/src/include/pa_stylesheet_manager.h 2003/11/20 16:34:25 1.18 @@ -1,11 +1,8 @@ /** @file Parser: Stylesheet manager decl. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: pa_stylesheet_manager.h,v 1.2 2001/10/29 08:23:49 paf Exp $ - + Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) global sql driver manager, must be thread-safe */ @@ -13,40 +10,35 @@ #ifndef PA_STYLESHEET_MANAGER_H #define PA_STYLESHEET_MANAGER_H -#include "pa_config_includes.h" -#include "pa_pool.h" -#include "pa_hash.h" -#include "pa_table.h" - - -// defines +static const char * const IDENT_STYLESHEET_MANAGER_H="$Date: 2003/11/20 16:34:25 $"; -// forwards - -class Stylesheet_connection; +#include "pa_hash.h" +#include "pa_table.h" +#include "pa_cache_managers.h" +#include "pa_stack.h" +#include "pa_stylesheet_connection.h" /** XSLT stylesheet driver manager maintains stylesheet cache expiring unused stylesheets */ -class Stylesheet_manager : public Pooled { +class Stylesheet_manager: public Cache_manager { friend class Stylesheet_connection; public: - Stylesheet_manager(Pool& pool); - ~Stylesheet_manager(); + Stylesheet_manager(); + override ~Stylesheet_manager(); /** check for disk update of "{file_spec}" or "{file_spec}.stamp", if not updated return cached version[if any] otherwise load/compile/return */ - Stylesheet_connection& get_connection(const String& file_spec); + Stylesheet_connection_ptr get_connection(const String& file_spec); private: // cache - Stylesheet_connection *get_connection_from_cache(const String& file_spec); + Stylesheet_connection* get_connection_from_cache(const String& file_spec); void put_connection_to_cache(const String& file_spec, Stylesheet_connection& connection); - void maybe_expire_connection_cache(); private: time_t prev_expiration_pass_time; @@ -55,12 +47,20 @@ private: // for stylesheet /// caches connection void close_connection(const String& file_spec, Stylesheet_connection& connection); +public: + typedef Stack connection_cache_value_type; + typedef Hash connection_cache_type; private: + connection_cache_type connection_cache; + +public: // Cache_manager + + override Value* get_status(); + override void maybe_expire_cache(); - Hash connection_cache; }; /// global -extern Stylesheet_manager *stylesheet_manager; +extern Stylesheet_manager stylesheet_manager; #endif