interface_8h.tex 7.97 KB
\hypertarget{interface_8h}{
\section{include/interface.h File Reference}
\label{interface_8h}\index{include/interface.h@{include/interface.h}}
}
{\ttfamily \#include $<$sys/types.h$>$}\par
Include dependency graph for interface.h:
This graph shows which files directly or indirectly include this file:
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structinterface}{interface}
\item 
struct \hyperlink{structiface__impl}{iface\_\-impl}
\end{DoxyCompactItemize}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{interface_8h_ad620a89e939b586d6a025cf342da8e55}{MAX\_\-IFACE}~32
\item 
\#define \hyperlink{interface_8h_a02255665665c91d905ec32d00d9a4a85}{IFACE}(name)~((const struct i\_\-\#\#name const$\ast$)\&i\_\-\#\#name\#\#\_\-impl)
\item 
\#define \hyperlink{interface_8h_a446cc7d7282f8a0b8e62a371671ea605}{INIT\_\-IFACE}(name,...)~static const struct i\_\-\#\#name i\_\-\#\#name\#\#\_\-impl = \{\&i\_\-\#\#name,\_\-\_\-VA\_\-ARGS\_\-\_\-\}
\item 
\#define \hyperlink{interface_8h_a9dda4d034150e3159927f83d9d15d840}{NUMARGS}(...)~(sizeof((const void$\ast$\mbox{[}$\,$\mbox{]})\{\_\-\_\-VA\_\-ARGS\_\-\_\-\})/sizeof(void$\ast$))
\item 
\#define \hyperlink{interface_8h_a6e8015282e5aac5747daff5bb71d8601}{INIT\_\-IMPL}(...)~\{NUMARGS(\_\-\_\-VA\_\-ARGS\_\-\_\-), 0, \{\_\-\_\-VA\_\-ARGS\_\-\_\-\}\}
\item 
\#define \hyperlink{interface_8h_a855b98f3119c2d64e7dd4c2c910bd5b5}{CREATE\_\-IMPL}(...)~static struct \hyperlink{structiface__impl}{iface\_\-impl} \hyperlink{structiface__impl}{iface\_\-impl} = INIT\_\-IMPL(\_\-\_\-VA\_\-ARGS\_\-\_\-)
\item 
\#define \hyperlink{interface_8h_a12243bdd01e5366fecc15f395f09221a}{METHOD\_\-GET}(iface, method)~(iface-\/$>$method)
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \hyperlink{structinterface}{interface} $\ast$ \hyperlink{interface_8h_afaa63cd951f41a496111e88acf36dc40}{iface\_\-ptr}
\item 
typedef struct \hyperlink{structiface__impl}{iface\_\-impl} $\ast$ \hyperlink{interface_8h_a998b025a5015049fd824424d6983f2df}{iface\_\-impl\_\-ptr}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structinterface}{interface} $\ast$ \hyperlink{interface_8h_ae4bb16dde691d2513d444ce772f48718}{interfaceGet} (\hyperlink{structiface__impl}{iface\_\-impl\_\-ptr}, const \hyperlink{structinterface}{iface\_\-ptr})
\end{DoxyCompactItemize}


\subsection{Define Documentation}
\hypertarget{interface_8h_a855b98f3119c2d64e7dd4c2c910bd5b5}{
\index{interface.h@{interface.h}!CREATE\_\-IMPL@{CREATE\_\-IMPL}}
\index{CREATE\_\-IMPL@{CREATE\_\-IMPL}!interface.h@{interface.h}}
\subsubsection[{CREATE\_\-IMPL}]{\setlength{\rightskip}{0pt plus 5cm}\#define CREATE\_\-IMPL(
\begin{DoxyParamCaption}
\item[{}]{...}
\end{DoxyParamCaption}
)~static struct {\bf iface\_\-impl} {\bf iface\_\-impl} = INIT\_\-IMPL(\_\-\_\-VA\_\-ARGS\_\-\_\-)}}
\label{interface_8h_a855b98f3119c2d64e7dd4c2c910bd5b5}


Definition at line 16 of file interface.h.

\hypertarget{interface_8h_a02255665665c91d905ec32d00d9a4a85}{
\index{interface.h@{interface.h}!IFACE@{IFACE}}
\index{IFACE@{IFACE}!interface.h@{interface.h}}
\subsubsection[{IFACE}]{\setlength{\rightskip}{0pt plus 5cm}\#define IFACE(
\begin{DoxyParamCaption}
\item[{}]{name}
\end{DoxyParamCaption}
)~((const struct i\_\-\#\#name const$\ast$)\&i\_\-\#\#name\#\#\_\-impl)}}
\label{interface_8h_a02255665665c91d905ec32d00d9a4a85}


Definition at line 8 of file interface.h.

\hypertarget{interface_8h_a446cc7d7282f8a0b8e62a371671ea605}{
\index{interface.h@{interface.h}!INIT\_\-IFACE@{INIT\_\-IFACE}}
\index{INIT\_\-IFACE@{INIT\_\-IFACE}!interface.h@{interface.h}}
\subsubsection[{INIT\_\-IFACE}]{\setlength{\rightskip}{0pt plus 5cm}\#define INIT\_\-IFACE(
\begin{DoxyParamCaption}
\item[{}]{name, }
\item[{}]{...}
\end{DoxyParamCaption}
)~static const struct i\_\-\#\#name i\_\-\#\#name\#\#\_\-impl = \{\&i\_\-\#\#name,\_\-\_\-VA\_\-ARGS\_\-\_\-\}}}
\label{interface_8h_a446cc7d7282f8a0b8e62a371671ea605}


Definition at line 10 of file interface.h.

\hypertarget{interface_8h_a6e8015282e5aac5747daff5bb71d8601}{
\index{interface.h@{interface.h}!INIT\_\-IMPL@{INIT\_\-IMPL}}
\index{INIT\_\-IMPL@{INIT\_\-IMPL}!interface.h@{interface.h}}
\subsubsection[{INIT\_\-IMPL}]{\setlength{\rightskip}{0pt plus 5cm}\#define INIT\_\-IMPL(
\begin{DoxyParamCaption}
\item[{}]{...}
\end{DoxyParamCaption}
)~\{NUMARGS(\_\-\_\-VA\_\-ARGS\_\-\_\-), 0, \{\_\-\_\-VA\_\-ARGS\_\-\_\-\}\}}}
\label{interface_8h_a6e8015282e5aac5747daff5bb71d8601}


Definition at line 15 of file interface.h.

\hypertarget{interface_8h_ad620a89e939b586d6a025cf342da8e55}{
\index{interface.h@{interface.h}!MAX\_\-IFACE@{MAX\_\-IFACE}}
\index{MAX\_\-IFACE@{MAX\_\-IFACE}!interface.h@{interface.h}}
\subsubsection[{MAX\_\-IFACE}]{\setlength{\rightskip}{0pt plus 5cm}\#define MAX\_\-IFACE~32}}
\label{interface_8h_ad620a89e939b586d6a025cf342da8e55}


Definition at line 6 of file interface.h.

\hypertarget{interface_8h_a12243bdd01e5366fecc15f395f09221a}{
\index{interface.h@{interface.h}!METHOD\_\-GET@{METHOD\_\-GET}}
\index{METHOD\_\-GET@{METHOD\_\-GET}!interface.h@{interface.h}}
\subsubsection[{METHOD\_\-GET}]{\setlength{\rightskip}{0pt plus 5cm}\#define METHOD\_\-GET(
\begin{DoxyParamCaption}
\item[{}]{iface, }
\item[{}]{method}
\end{DoxyParamCaption}
)~(iface-\/$>$method)}}
\label{interface_8h_a12243bdd01e5366fecc15f395f09221a}


Definition at line 19 of file interface.h.

\hypertarget{interface_8h_a9dda4d034150e3159927f83d9d15d840}{
\index{interface.h@{interface.h}!NUMARGS@{NUMARGS}}
\index{NUMARGS@{NUMARGS}!interface.h@{interface.h}}
\subsubsection[{NUMARGS}]{\setlength{\rightskip}{0pt plus 5cm}\#define NUMARGS(
\begin{DoxyParamCaption}
\item[{}]{...}
\end{DoxyParamCaption}
)~(sizeof((const void$\ast$\mbox{[}$\,$\mbox{]})\{\_\-\_\-VA\_\-ARGS\_\-\_\-\})/sizeof(void$\ast$))}}
\label{interface_8h_a9dda4d034150e3159927f83d9d15d840}


Definition at line 13 of file interface.h.



\subsection{Typedef Documentation}
\hypertarget{interface_8h_a998b025a5015049fd824424d6983f2df}{
\index{interface.h@{interface.h}!iface\_\-impl\_\-ptr@{iface\_\-impl\_\-ptr}}
\index{iface\_\-impl\_\-ptr@{iface\_\-impl\_\-ptr}!interface.h@{interface.h}}
\subsubsection[{iface\_\-impl\_\-ptr}]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf iface\_\-impl}$\ast$ {\bf iface\_\-impl\_\-ptr}}}
\label{interface_8h_a998b025a5015049fd824424d6983f2df}


Definition at line 33 of file interface.h.

\hypertarget{interface_8h_afaa63cd951f41a496111e88acf36dc40}{
\index{interface.h@{interface.h}!iface\_\-ptr@{iface\_\-ptr}}
\index{iface\_\-ptr@{iface\_\-ptr}!interface.h@{interface.h}}
\subsubsection[{iface\_\-ptr}]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf interface}$\ast$ {\bf iface\_\-ptr}}}
\label{interface_8h_afaa63cd951f41a496111e88acf36dc40}


Definition at line 26 of file interface.h.



\subsection{Function Documentation}
\hypertarget{interface_8h_ae4bb16dde691d2513d444ce772f48718}{
\index{interface.h@{interface.h}!interfaceGet@{interfaceGet}}
\index{interfaceGet@{interfaceGet}!interface.h@{interface.h}}
\subsubsection[{interfaceGet}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf interface}$\ast$ interfaceGet (
\begin{DoxyParamCaption}
\item[{{\bf iface\_\-impl\_\-ptr}}]{iface\_\-impl, }
\item[{const {\bf iface\_\-ptr}}]{\_\-iface}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}read\mbox{]}}}}
\label{interface_8h_ae4bb16dde691d2513d444ce772f48718}
this one is important in selector functions to get the correct interface implementation of a class. 

Definition at line 25 of file interface.c.


\begin{DoxyCode}
{
        const iface_ptr * iface = &_iface;
        void *            dummy;

    if (! iface_impl->simpl) {
        qsort((void**)(iface_impl->impl), iface_impl->nimpl, sizeof(iface_ptr), c
      omp);
        iface_impl->simpl=TRUE;
    }

    dummy = bsearch(
                        &iface,
                        iface_impl->impl,
                        iface_impl->nimpl,
                        sizeof(iface_ptr),
                        comp);

        return dummy? *(struct interface **)dummy : dummy;
}
\end{DoxyCode}