A fuzzy logic C++ library
Defines | Functions
app_common.hpp File Reference

Common declarations for demos and applications, not exported into user apps. More...

#include <cstdlib>
+ Include dependency graph for app_common.hpp:
+ This graph shows which files directly or indirectly include this file:

Defines

#define LOG_USER_ERROR   SLIFIS_LOG << "ERROR in " << SLIFIS_FUNCTION << " at line : " << __LINE__ << ": "
#define APP_MSG   std::cout << " - "
 Defines the stream where user information is printed, for demos and applications only, not used in core library.
#define APP_FATAL_ERROR(a)   APP_MSG << "Error: " << a << ", exiting, see " << STDERR_FILE_NAME << endl; exit(__COUNTER__+1)
 a macro for printing on stdout a short error message (a) for the user, and exiting with a specific code.
#define REOPEN_STDERR(a)
 Reopens stderr/cerr to a file, only used in demos and applications, not in core library.
#define APP_NAME   static std::string app_name(argv[0]); APP_MSG << "start\n"
 This macro is to be placed right after the beginning of main(), and assumes that 'main' follows the common signature.
#define APP_REGULAR_END
#define APP_FAILURE(a)

Functions

void usage ()
 Prints application usage (arguments)

Detailed Description

Common declarations for demos and applications, not exported into user apps.


Define Documentation

#define LOG_USER_ERROR   SLIFIS_LOG << "ERROR in " << SLIFIS_FUNCTION << " at line : " << __LINE__ << ": "

Referenced by main().

#define APP_MSG   std::cout << " - "

Defines the stream where user information is printed, for demos and applications only, not used in core library.

Referenced by main().

#define APP_FATAL_ERROR (   a)    APP_MSG << "Error: " << a << ", exiting, see " << STDERR_FILE_NAME << endl; exit(__COUNTER__+1)

a macro for printing on stdout a short error message (a) for the user, and exiting with a specific code.

Referenced by main().

#define REOPEN_STDERR (   a)
Value:
if( false == freopen( a, "wt", stderr ) ) \
        { \
                APP_MSG << "ERROR: Unable to redirect stderr to "<< (a) << " for some unknown reason, exiting.\n"; \
                exit(1); \
        } \
        SLIFIS_STAMP_F( stderr ); \
        fprintf( stderr, "# generated by app: %s\n\n", argv[0] )

Reopens stderr/cerr to a file, only used in demos and applications, not in core library.

Referenced by main().

#define APP_NAME   static std::string app_name(argv[0]); APP_MSG << "start\n"

This macro is to be placed right after the beginning of main(), and assumes that 'main' follows the common signature.

(i.e. "int main( int argc, char** argv )" )

Referenced by main().

#define APP_REGULAR_END
Value:
APP_MSG << "regular ending\n"; \
        return 0;

Referenced by main().

#define APP_FAILURE (   a)
Value:
{ \
                APP_MSG << "failure\n"; \
                std::cerr << "Failure of " << #a << std::endl; \
                return __COUNTER__+1; \
        }

Referenced by main().


Function Documentation

void usage ( )

Prints application usage (arguments)

Referenced by main().