net_instaweb::RewriteOptions::OptionTemplateBase< T > Class Template Reference

#include "rewrite_options.h"

Inheritance diagram for net_instaweb::RewriteOptions::OptionTemplateBase< T >:
net_instaweb::RewriteOptions::OptionBase net_instaweb::ApacheConfig::ApacheOption< T > net_instaweb::RewriteOptions::Option< T >

List of all members.

Public Member Functions

virtual bool was_set () const
void set (const T &val)
void set_default (const T &val)
const T & value () const
virtual void Merge (const OptionBase *src)
void MergeHelper (const OptionTemplateBase *src)

Detailed Description

template<class T>
class net_instaweb::RewriteOptions::OptionTemplateBase< T >

Helper class to represent an Option, whose value is held in some class T. An option is explicitly initialized with its default value, although the default value can be altered later. It keeps track of whether a value has been explicitly set (independent of whether that happens to coincide with the default value).

It can use this knowledge to intelligently merge a 'base' option value into a 'new' option value, allowing explicitly set values from 'base' to override default values from 'new'.


Member Function Documentation

template<class T>
virtual void net_instaweb::RewriteOptions::OptionTemplateBase< T >::Merge ( const OptionBase src  )  [inline, virtual]

The signature of the Merge implementation must match the base-class. The caller is responsible for ensuring that only the same typed Options are compared. In RewriteOptions::Merge this is guaranteed because the vector<OptionBase*> all_options_ is sorted on option_enum(). We DCHECK that the option_enum of this and src are the same.

Implements net_instaweb::RewriteOptions::OptionBase.

Reimplemented in net_instaweb::RewriteOptions::MutexedOptionInt64MergeWithMax.

template<class T>
void net_instaweb::RewriteOptions::OptionTemplateBase< T >::MergeHelper ( const OptionTemplateBase< T > *  src  )  [inline]

Even if !src->was_set, the default value needs to be transferred over in case it was changed with set_default or SetDefaultRewriteLevel.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:05 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3