\hypertarget{classkdb_1_1Context}{}\section{kdb\+::Context Class Reference}
\label{classkdb_1_1Context}\index{kdb::Context@{kdb::Context}}


Provides a context for configuration.  




{\ttfamily \#include $<$kdbcontext.\+hpp$>$}



Inherits kdb\+::\+Subject.



Inherited by kdb\+::\+Thread\+Context.

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Context_adbd89b28f978fb99bb5315cf7732c40f}{operator\mbox{[}$\,$\mbox{]}}} (std\+::string const \&layer) const
\begin{DoxyCompactList}\small\item\em Lookup value for a current active layer. \end{DoxyCompactList}\item 
size\+\_\+t \mbox{\hyperlink{classkdb_1_1Context_a2208d178203f74652a2a023b66d445fd}{size}} () const
\item 
void \mbox{\hyperlink{classkdb_1_1Context_afcbfe897ee36eb4fee23640051122e54}{attach\+By\+Name}} (std\+::string const \&key\+\_\+name, \mbox{\hyperlink{classkdb_1_1ValueObserver}{Value\+Observer}} \&observer)
\begin{DoxyCompactList}\small\item\em Attach observer using to all events given by its specification (name) \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Context_a7cf9cda848595583ea35c8041d6466ee}{evaluate}} (std\+::string const \&key\+\_\+name) const
\begin{DoxyCompactList}\small\item\em Evaluate a specification (name) and return a key name under current context. \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Context_a50ecf7ad3b5685f11a0bdaa65abd8f62}{evaluate}} (std\+::string const \&key\+\_\+name, std\+::function$<$ bool(std\+::string const \&, std\+::string \&, bool in\+\_\+group)$>$ const \&on\+\_\+layer) const
\begin{DoxyCompactList}\small\item\em Evaluate specification with this context. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T , typename... Args$>$ }\\std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classkdb_1_1Layer}{Layer}} $>$ \mbox{\hyperlink{classkdb_1_1Context_ae6313bea68b242fa50817c604a67e704}{activate}} (Args \&\&... args)
\begin{DoxyCompactList}\small\item\em Globally activate the layer. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Provides a context for configuration. 

Is a subject for observers.

Holds currently active layers and allows global/scoped activation of layers. 

\subsection{Member Function Documentation}
\mbox{\Hypertarget{classkdb_1_1Context_ae6313bea68b242fa50817c604a67e704}\label{classkdb_1_1Context_ae6313bea68b242fa50817c604a67e704}} 
\index{kdb::Context@{kdb::Context}!activate@{activate}}
\index{activate@{activate}!kdb::Context@{kdb::Context}}
\subsubsection{\texorpdfstring{activate()}{activate()}}
{\footnotesize\ttfamily template$<$typename T , typename... Args$>$ \\
std\+::shared\+\_\+ptr$<$\mbox{\hyperlink{classkdb_1_1Layer}{Layer}}$>$ kdb\+::\+Context\+::activate (\begin{DoxyParamCaption}\item[{Args \&\&...}]{args }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Globally activate the layer. 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & the layer to activate \\
\hline
{\em Args} & the types for the arguments to pass to layer construction \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em args} & the arguments to pass to layer construction \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classkdb_1_1Context_afcbfe897ee36eb4fee23640051122e54}\label{classkdb_1_1Context_afcbfe897ee36eb4fee23640051122e54}} 
\index{kdb::Context@{kdb::Context}!attachByName@{attachByName}}
\index{attachByName@{attachByName}!kdb::Context@{kdb::Context}}
\subsubsection{\texorpdfstring{attachByName()}{attachByName()}}
{\footnotesize\ttfamily void kdb\+::\+Context\+::attach\+By\+Name (\begin{DoxyParamCaption}\item[{std\+::string const \&}]{key\+\_\+name,  }\item[{\mbox{\hyperlink{classkdb_1_1ValueObserver}{Value\+Observer}} \&}]{observer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Attach observer using to all events given by its specification (name) 


\begin{DoxyParams}{Parameters}
{\em key\+\_\+name} & the name with placeholders to be used for attaching \\
\hline
{\em observer} & the observer to attach to \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classkdb_1_1Context_a7cf9cda848595583ea35c8041d6466ee}\label{classkdb_1_1Context_a7cf9cda848595583ea35c8041d6466ee}} 
\index{kdb::Context@{kdb::Context}!evaluate@{evaluate}}
\index{evaluate@{evaluate}!kdb::Context@{kdb::Context}}
\subsubsection{\texorpdfstring{evaluate()}{evaluate()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Context\+::evaluate (\begin{DoxyParamCaption}\item[{std\+::string const \&}]{key\+\_\+name }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Evaluate a specification (name) and return a key name under current context. 


\begin{DoxyParams}{Parameters}
{\em key\+\_\+name} & the name with placeholders to be evaluated \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classkdb_1_1Context_a50ecf7ad3b5685f11a0bdaa65abd8f62}\label{classkdb_1_1Context_a50ecf7ad3b5685f11a0bdaa65abd8f62}} 
\index{kdb::Context@{kdb::Context}!evaluate@{evaluate}}
\index{evaluate@{evaluate}!kdb::Context@{kdb::Context}}
\subsubsection{\texorpdfstring{evaluate()}{evaluate()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Context\+::evaluate (\begin{DoxyParamCaption}\item[{std\+::string const \&}]{key\+\_\+name,  }\item[{std\+::function$<$ bool(std\+::string const \&, std\+::string \&, bool in\+\_\+group)$>$ const \&}]{on\+\_\+layer }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Evaluate specification with this context. 


\begin{DoxyParams}{Parameters}
{\em key\+\_\+name} & the keyname with placeholders to evaluate \\
\hline
{\em on\+\_\+layer} & the function to be called for every placeholder found\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{on\+\_\+layer is called for every layer in the}
specification. 
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the evaluated string 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Context_adbd89b28f978fb99bb5315cf7732c40f}\label{classkdb_1_1Context_adbd89b28f978fb99bb5315cf7732c40f}} 
\index{kdb::Context@{kdb::Context}!operator\mbox{[}\mbox{]}@{operator[]}}
\index{operator\mbox{[}\mbox{]}@{operator[]}!kdb::Context@{kdb::Context}}
\subsubsection{\texorpdfstring{operator[]()}{operator[]()}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Context\+::operator\mbox{[}$\,$\mbox{]} (\begin{DoxyParamCaption}\item[{std\+::string const \&}]{layer }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Lookup value for a current active layer. 


\begin{DoxyParams}{Parameters}
{\em layer} & the name of the requested layer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the layer 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Context_a2208d178203f74652a2a023b66d445fd}\label{classkdb_1_1Context_a2208d178203f74652a2a023b66d445fd}} 
\index{kdb::Context@{kdb::Context}!size@{size}}
\index{size@{size}!kdb::Context@{kdb::Context}}
\subsubsection{\texorpdfstring{size()}{size()}}
{\footnotesize\ttfamily size\+\_\+t kdb\+::\+Context\+::size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
size of all current layers (to be used with operator\mbox{[}\mbox{]}) 
\end{DoxyReturn}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{kdbcontext_8hpp}{kdbcontext.\+hpp}}\end{DoxyCompactItemize}
