libtrbase  1.0.2
Web server and task management solution.
interface.h File Reference
#include <sys/types.h>
+ Include dependency graph for interface.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TR_IF(name)   ((const struct i_##name const*)&i_##name##_impl)
 
#define TR_INIT_IFACE(name, ...)   static const struct i_##name i_##name##_impl = {&i_##name,__VA_ARGS__}
 
#define TR_IFID   const struct TR_interface * const _
 
#define TR_INTERFACE(name)
 
#define TR_CREATE_INTERFACE(name, nfunc)   const struct TR_interface i_##name = { nfunc }
 

Detailed Description

Interface definition code. Each interface is a set of selector functions as well as a data structure where the concrete implementation will be stored. This structure is the intergrated in the class that implements the interface.

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file interface.h.

Macro Definition Documentation

#define TR_CREATE_INTERFACE (   name,
  nfunc 
)    const struct TR_interface i_##name = { nfunc }

Initialize the TR_interface structure for a new interface

Definition at line 70 of file interface.h.

#define TR_IF (   name)    ((const struct i_##name const*)&i_##name##_impl)

The maximum number of interfaces per class. Get interface implementation in the current compile context by it's interface name. TR_CREATE_CLASS accepts a list of interface implementations for initialization of the class. This makes it easier to add these.

See also
TR_CREATE_CLASS

Definition at line 49 of file interface.h.

#define TR_IFID   const struct TR_interface * const _

Definition at line 61 of file interface.h.

Referenced by TR_INTERFACE().

#define TR_INIT_IFACE (   name,
  ... 
)    static const struct i_##name i_##name##_impl = {&i_##name,__VA_ARGS__}

Create an implementation of the interface "name" with the functions given in the variable argument list. This in turn can then be used within class initializations.

See also
TR_IF

Definition at line 58 of file interface.h.

#define TR_INTERFACE (   name)
Value:
extern const struct TR_interface i_##name; \
struct i_##name

Definition at line 63 of file interface.h.